  /* ---- Chat: its panel, the messages, the activity, its box, its bar, the bubbles, beside and as a sheet ---- */
  /* Chat's own panel (its bar, messages and box), with its own scroll area. As the page (body.chat-here) it takes the
     middle and the pages' scroller is hidden; on a wide screen it is the right column (body.chat-beside, below); on a phone
     and narrower windows a sheet (body.chat-sheet-open, below). #pageFoot is the page's own held bottom (a project's box,
     the newer-build bar). */
  #chatPanel { display: none; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
  #chatPanel { container: chat / inline-size; } /* for its card on a very wide window (the last rules here) */
  body.chat-here #chatPanel { display: flex; flex: 1; }
  body.chat-here #scroller { display: none; }
  #chatScroller { flex: 1; overflow-y: auto; position: relative; }
  #chatInner { max-width: 720px; margin: 0 auto; padding: 54px 32px 32px; }
  #chatSheetHead { display: none; }
  /* no page hides Chat's greeting, log or sync line: they are in Chat's panel, which shows as a whole or not at all. */
  #pageHead .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  #pageHead h1 { font-family: var(--display); font-weight: 500; font-size: 38px; line-height: 1.15; letter-spacing: -0.015em; margin: 10px 0 0; }
  #pageHead .lede { font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.55; color: var(--ink-soft); margin: 14px 0 0; }
  body.has-chat #chatInner { padding-top: 28px; }
  #chatlog { margin-top: 34px; }
  .msg { margin: 0 0 34px; }
  .restored-note { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; margin: 0 0 30px; padding-bottom: 10px; border-bottom: var(--bw) dashed var(--line); }
  .msg .role { display: none; }
  .msg.user { text-align: right; }
  .msg.user .bubble { display: inline-block; max-width: 85%; text-align: left; font-family: var(--serif); font-style: italic; font-size: 17.5px; line-height: 1.55; color: var(--ink-soft); white-space: pre-wrap; }
  .msg.model .role { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); font-weight: 500; margin-bottom: 10px; }
  .msg.model .bubble { font-family: var(--serif); font-size: 17.5px; line-height: 1.75; color: var(--ink); }
  /* the opening capital. A long first paragraph gets a true drop cap three lines deep,
     its top level with the first line and its foot on the third line's baseline. A short one
     gets a raised cap standing on the first line, so no paragraph or list has to wrap around
     a letter taller than itself. Browsers without initial-letter (Firefox) show plain text. */
  @supports (initial-letter: 3) or (-webkit-initial-letter: 3) {
    .bubble p.dropcap::first-letter { -webkit-initial-letter: 3; initial-letter: 3; color: var(--accent-text); font-weight: 500; margin-right: .3em; }
    .bubble p.raisedcap::first-letter { -webkit-initial-letter: 2 1; initial-letter: 2 1; color: var(--accent-text); font-weight: 500; margin-right: .2em; }
  }
  .bubble p { margin: 0 0 16px; }
  .bubble p:last-child { margin-bottom: 0; }
  .bubble h2, .bubble h3, .bubble h4 { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); margin: 26px 0 10px; padding-bottom: 8px; border-bottom: var(--bw) var(--bs) var(--line); }
  .bubble h2:first-child, .bubble h3:first-child, .bubble h4:first-child { margin-top: 0; }
  .bubble ul, .bubble ol { margin: 0 0 16px; padding-left: 22px; }
  .bubble li { margin: 4px 0; }
  .bubble li::marker { color: var(--accent-text); }
  .bubble hr { border: none; border-top: var(--bw) var(--bs) var(--line); margin: 24px 0; }
  .bubble code { font-family: var(--mono); font-size: .82em; background: var(--accent-soft); padding: 1px 5px; border-radius: var(--r-sm); }
  .bubble strong { font-weight: 600; }
  .msg.error .bubble { background: var(--danger-bg); border: var(--bw) var(--bs) var(--danger-line); border-radius: var(--r-md); padding: 12px 16px; color: var(--danger); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
  .msg.note .bubble { background: var(--card); border: var(--bw) var(--bs) var(--line); border-radius: var(--r-md); padding: 12px 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
  .msg.tool { margin: 0; }
  .msg.tool .bubble { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--muted); white-space: pre-wrap; word-break: break-word; padding: 3px 0; border-bottom: var(--bw) dashed var(--line); }
  .sources { margin-top: 26px; padding-top: 16px; border-top: var(--bw) var(--bs) var(--line); }
  .sources .label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
  .sources ol { margin: 0; padding-left: 20px; font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
  /* ---- activity (the tool steps, folded away) ---- */
  .activity { margin: -14px 0 30px; }
  .activity summary { list-style: none; display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 6px 12px 6px 10px; border: var(--bw) var(--bs) var(--line); border-radius: var(--r-pill); background: var(--card); user-select: none; }
  .activity summary::-webkit-details-marker { display: none; }
  .activity summary:hover { color: var(--ink-soft); }
  .activity .act-dot { width: 8px; height: 8px; border-radius: var(--r-round); background: var(--line); flex: none; }
  .activity.running .act-dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
  .activity .act-label { color: var(--ink-soft); font-weight: 500; }
  .activity .act-step { max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .activity .act-time { font-variant-numeric: tabular-nums; }
  .activity .act-step:not(:empty)::before, .activity .act-time:not(:empty)::before { content: "\00b7"; margin-right: 10px; color: var(--line); }
  .activity .act-chev { font-size: 10px; transition: transform .15s; }
  .activity[open] .act-chev { transform: rotate(90deg); }
  .activity .act-body { margin-top: 10px; padding: 10px 14px; background: var(--card); border: var(--bw) var(--bs) var(--line); border-radius: var(--r-md); max-height: 360px; overflow-y: auto; }
  @keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }
  /* ---- composer ---- */
  #composer { flex: none; padding: 12px 32px calc(24px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--paper) 30%); }
  #syncBar { max-width: 656px; margin: 0 auto 6px; display: flex; justify-content: flex-end; font-size: 11.5px; color: var(--muted); }
  /* a newer Creative Chief on the site */
  #newBuildBar { max-width: 656px; margin: 8px auto; font-size: 12.5px; color: var(--ink); background: var(--accent-soft); border: var(--bw) var(--bs) var(--line); border-radius: var(--r-sm); padding: 6px 10px; } /* in the page's foot, under whatever shows */
  #newBuildBar[hidden] { display: none; }
  #syncBar[hidden] { display: none; }
  .memory-divider { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); text-align: center; margin: 6px 0 28px; padding-top: 10px; border-top: var(--bw) dashed var(--deco); }
  #composer-inner { max-width: 656px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; background: var(--card); border: var(--bw) var(--bs) var(--field-border); border-radius: var(--r-lg); padding: 10px 10px 10px 18px; box-shadow: var(--shadow-field); }
  #composer-inner:focus-within { box-shadow: 0 0 0 3px var(--focus); }
  #composerInput:focus-visible { outline: none; }
  #composerInput { flex: 1; border: none; background: none; resize: none; outline: none; font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--ink); min-height: 44px; max-height: 200px; padding: 9px 0; } /* one line sits level with the 44px buttons */
  #composerInput::placeholder { color: var(--muted); }
  #composerInput::placeholder, .page-box textarea::placeholder, .page-box input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one line, not a clipped second one */
  #sendBtn { flex: none; width: 44px; height: 44px; border-radius: var(--r-round); border: none; background: var(--accent); color: var(--on-accent); font-size: 17px; display: grid; place-items: center; padding: 0; }
  #sendBtn:hover:not(:disabled) { background: var(--accent-hover); }
  #sendBtn:disabled { opacity: .45; cursor: default; }
  #sendBtn.stop { background: var(--ink-soft); color: var(--on-ink); font-size: 13px; }
  #micBtn { flex: none; width: 44px; height: 44px; border-radius: var(--r-round); border: var(--bw) var(--bs) var(--field-border); background: var(--card); color: var(--ink-soft); display: grid; place-items: center; padding: 0; }
  #micBtn[hidden] { display: none; }
  #micBtn:hover { color: var(--ink); }
  #micBtn.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
  #sendBtn.stop:hover:not(:disabled) { background: var(--ink); }
  #chatScroller { overscroll-behavior: contain; } /* Chat's own scroll area */
  @media (max-width: 820px) {
    #composer { padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); }
    #pageHead h1 { font-size: 30px; }
    .msg.model .bubble, .msg.user .bubble { font-size: 16.5px; }
    .activity .act-step { max-width: 150px; }
  }
  #chatWithModule { position: relative; }
  #chatWithModule.has-new { padding-right: 22px; }
  #chatWithModule.has-new::after { content: ""; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); width: 11px; height: 11px; box-sizing: border-box; border-radius: var(--r-round); background: var(--accent); border: 2px solid var(--paper); }
  @media (max-width: 820px) {
    #composer { padding-bottom: 12px; } /* finding ER: the bar below pads for the safe area */
  }
  /* the Chat piece. Chat's box is Main Chat's, on a phone and a computer; only the box itself hides, so the "newer
     Creative Chief" bar shows on every page. Chat's bar (its title on a computer, What can I say?, "⋯", the Creative
     Chief | <group> chat switch), the group's chat as bubbles, the Journal's and a project page's own boxes, and Main
     Chat beside Today pressed on a wide screen. Theme tokens only. */
  body.chat-group #composer-inner, body.chat-group #syncBar { display: none; } /* the panel hides as a whole when Chat isn't showing */
  #chatGroupHost { display: none; }
  /* Chat's bar: Chat's panel shows it wherever Chat is. It stays at the top while the messages scroll under it (on a
     phone, the Creative Chief | <group> chat switch, under the top bar); empty, it has no height. Its shadow covers the
     hairline of a message above the held bar. */
  #chatBar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 6px; position: sticky; top: 0; z-index: 6; background: var(--paper); box-shadow: 0 -2px 0 var(--paper); }
  @media (max-width: 820px) { body.chat-in-group #chatBar { top: -1px; margin-top: -1px; padding-top: 1px; } } /* in a group, where the bar holds the switch (with no group it stays empty, no height): the bar sits a pixel above the scroll area's top, scrolled or not (its top pixel clipped), so a fractional scroll on a phone shows no sliver; the switch doesn't move */
  #chatWith { margin: 6px 0; }
  /* in Chat no page padding above the held bar, so it sits in the same place with a short chat or a long one (scrolled
     or not). On a phone the bar holds only the switch, so this is in a group (chat-in-group; with no group the bar is
     empty, no height, and the page keeps its padding); on a computer always, the bar keeping its own room. */
  body.chat-in-group #chatInner, body.chat-sheet-open #chatInner { padding-top: 0; }
  @media (min-width: 821px) { #chatInner { padding-top: 0; } }
  .chat-bar-title { flex: 1 1 auto; min-width: 0; margin: 0; font-family: var(--display); font-weight: 500; font-size: 24px; line-height: 1.2; color: var(--ink); text-shadow: var(--heading-shadow); }
  .chat-bar-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
  .chat-say-btn { min-height: 40px; padding: 6px 14px; border-radius: var(--r-pill); font-size: 14px; }
  .chat-more-wrap { position: relative; }
  .chat-more { width: 40px; height: 40px; border-radius: var(--r-round); border: 0; background: none; color: var(--ink-soft); font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
  .chat-more[aria-expanded="true"] { background: var(--hover-wash-strong); color: var(--ink); }
  @media (hover: hover) { .chat-more:hover { background: var(--hover-wash-strong); color: var(--ink); } }
  .chat-with { order: 3; flex: 1 1 100%; display: flex; gap: 4px; padding: 4px; background: var(--rail); border: var(--bw) var(--bs) var(--line); border-radius: var(--r-lg); }
  .chat-with[hidden] { display: none; }
  .chat-with button { flex: 1 1 0; min-width: 0; min-height: 40px; border: 0; background: none; border-radius: var(--r-md); font: inherit; font-size: 14px; color: var(--ink-soft); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; }
  .chat-with button:hover { color: var(--ink); background: var(--hover-wash); }
  .chat-with button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-field); }
  /* no What can I say? or "⋯" on a group's or a module's side (chat-tools-off, set with chat-group and chat-module),
     anywhere. On a computer their row is kept (unseen, out of reach), so the switch sits in the same place on every side. */
  body.chat-tools-off .chat-bar-tools { display: none; }
  @media (min-width: 821px) { body.chat-tools-off .chat-bar-tools { display: flex; visibility: hidden; } }
  body.chat-group #chatGroupHost { display: block; margin-top: 10px; }
  body.chat-group #pageHead, body.chat-group #chatlog { display: none; }
  #chatGroupHost #gpChatBox { margin: 0; padding: 0; background: none; border: 0; box-shadow: none; }
  /* the group chat's head (the group, Members and settings, a few faces) and the switch's news dot */
  /* the group chat's head, in Chat's held bar under the switch: one line (picture, name, the count,
     Members and settings ›); shown only while the group's chat is chosen. */
  .chat-group-head { display: none; }
  body.chat-group .chat-group-head { order: 4; flex: 1 1 100%; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; margin: 0 0 4px; padding: 4px 10px 4px 6px; border: var(--bw) var(--bs) var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .chat-group-head:hover { background: var(--hover-wash-strong); }
  .chat-group-head .gs-mark { width: 30px; height: 30px; flex: none; }
  .cgh-name { flex: 0 1 auto; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cgh-count { flex: none; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
  .cgh-count:empty { display: none; }
  .cgh-sub { flex: 0 100 auto; min-width: 0; margin-left: auto; font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* where room runs short it gives way first, so the group's name shows */
  /* the dot drawn the pill's way and size (.gs-badge), not a text bullet */
  #chatWithGroup.has-new::after { content: ""; width: 11px; height: 11px; box-sizing: border-box; border-radius: var(--r-round); background: var(--accent); border: 2px solid var(--paper); }
  /* the dot sits at the button's end, outside the text an ellipsis cuts. */
  .chat-with { min-width: 0; } /* with a long name the switch grew past a phone's screen (a flex item's automatic minimum is its buttons' whole
     text), so the page slid sideways and the dot was off the edge */
  #chatWithGroup { position: relative; }
  #chatWithGroup.has-new { padding-right: 22px; }
  #chatWithGroup.has-new::after { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
  /* a project's box and, in Chat, the group chat's sit where Chat's box is, at the bottom. */
  #pageFoot .pp-ask, #composer .gp-chat-send { max-width: 656px; margin: 0 auto; } /* the project's box in the page's foot */
  @media (max-width: 820px) {
    .chat-bar-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; } /* the top bar or the sheet's head says Chat */
    .chat-say-btn, .chat-more, .chat-with button { min-height: 44px; }
    .chat-more { width: 44px; height: 44px; }
  }
  @media (min-width: 821px) { #chatBar { padding: 14px 0 8px; } } /* its own padding, with no negative margin under the page's */
  @media (min-width: 821px) { #chatScroller { scrollbar-gutter: stable; } } /* no sideways jump */
  /* on a wide screen Chat is the right column beside Today pressed, the Calendar, or any page flipped to it
     (body.chat-beside): held at the right at the column's width, Today's column stepping aside (or, pressed, stopping
     short of it). The switch sits at the top of whichever the column shows. From 821px, so a narrower window and a
     phone on its side have Chat beside too (a 320px column there, opened from the title bar's chat icon, with no switch:
     Today is a place at that width). */
  @media (min-width: 821px) {
    body.chat-beside #chatPanel { display: flex; flex: none; position: fixed; top: 0; bottom: 0; right: 0; width: var(--chat-beside-w, var(--side-width)); z-index: 5; background: var(--rail); border-left: var(--bw) var(--bs) var(--line); } /* under the scrim (20) and the drawers (21), which come before #main; Today pressed and You stop short of it */
    body.chat-beside:not(.today-open) #todayPanel { display: none; }
    body.chat-beside:not(.today-open) #app { padding-right: var(--side-width); }
    body.chat-beside.today-open #todayPanel, body.chat-beside.today-on.today-open #todayPanel { right: var(--side-width); border-right: var(--bw) var(--bs) var(--line); }
    body.chat-beside #chatInner { padding: 0 18px 20px; } /* the bar's own room, as everywhere; Today's column's 18px, so the titles start at one place */
    body.chat-beside #chatBar { background: var(--rail); box-shadow: 0 -2px 0 var(--rail); }
    body.chat-beside #composer { padding-left: 16px; padding-right: 16px; background: linear-gradient(to bottom, transparent, var(--rail) 30%); }
    body.chat-beside #pageHead h1 { font-size: 28px; }
    body.chat-beside #composerInput { font-size: 16px; }
  }
  @media (min-width: 1101px) {
    /* Today's column keeps its scroll bar's room (so the switch doesn't narrow when it starts to scroll), and Chat's
       wrap reserves the same room (a gutter with nothing to scroll), so the switch is one width over either; Chat's
       title is Today's size and sits where Today's does (the wrap's 8px below, the bar's 14px above). */
    body:not(.today-open) #todayPanel { scrollbar-gutter: stable; }
    body.chat-beside #chatPanel > #sideSwitchWrap { padding: 14px 18px 8px; overflow: hidden; scrollbar-gutter: stable; } /* 18px: Today's column's own padding */
    body.chat-beside .chat-bar-title { font-size: 22px; line-height: 1.2; }
    body.side-today #todayPanel .tp-title { line-height: 1.2; } /* one line box for both, so the glyphs sit the same */
    body.side-today #todayPanel .tp-head { align-items: center; min-height: 40px; } /* Today's title centered in a 40px row, as Chat's is in its tools' row */
    body.side-today #todayPanel { padding-top: 0; } /* the switch's own bar takes the top */
    #todayPanel > #sideSwitchWrap { position: sticky; top: 0; z-index: 3; margin: 0 -18px 14px; padding: 14px 18px 8px; background: var(--rail); }
  }
  /* with no right column (a phone, 821 to 1100px) the Calendar's chat button opens Chat as a sheet over the page: a
     half-height sheet from the bottom on a phone. */
  @media (max-width: 1100px) {
    body.chat-sheet-open #chatPanel { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 64%; max-height: 88%; z-index: 26; background: var(--paper); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-panel); }
    body.chat-sheet-open #chatSheetHead { display: flex; align-items: center; gap: 8px; position: relative; padding: 14px 16px 0; } /* no grab handle; the sheet doesn't drag */
    #chatSheetTitle { flex: 1 1 auto; min-width: 0; margin: 0; font-family: var(--display); font-weight: 500; font-size: 22px; color: var(--ink); }
    #chatSheetClose { display: inline-block; }
    /* in the sheet Chat's bar (the switch, the group's head) sits under the sheet's head, out of the scroll area (moved
       there by placeChatBar), a plain row: nothing can scroll above or under it, so no sliver on any phone. */
    body.chat-sheet-open #chatPanel > #chatBar { position: static; top: auto; margin: 0; padding: 0 16px 6px; box-shadow: none; }
    body.chat-sheet-open #chatSheetHead .chat-bar-tools { margin: 0; } /* beside the sheet's title, so the switch stays put */
    body.chat-sheet-open #chatSheetHead .chat-more-wrap { display: none; }
    body.chat-sheet-open .chat-group-head { display: none; } /* no group head in the sheet (Chat's own page keeps it) */
    body.chat-sheet-open #composer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  }
  /* in a short window the sheet is the whole height. The sheet is a phone's only (a phone held upright); from 821px
     Chat sits beside the page. */
  @media (max-width: 1100px) and (max-height: 560px) {
    body.chat-sheet-open #chatPanel { top: 0; height: auto; max-height: none; border-top-left-radius: 0; border-top-right-radius: 0; }
    body.chat-sheet-open #chatSheetHead { padding-top: 10px; }
  }
  #chatModuleHost { display: none; }
  body.chat-module #chatModuleHost { display: block; margin-top: 10px; }
  body.chat-module #composer-inner, body.chat-module #syncBar, body.chat-module #pageHead, body.chat-module #chatlog { display: none; }
  #chatModuleState:empty { display: none; }
  /* With room to spare (about 1,400px of Chat), Chat's column, its messages and its box, on a card of its own, so the
     narrow column looks meant; the words stay 720px wide. Last in the file, after the rules it changes. */
  @container chat (min-width: 1400px) {
    #chatScroller, #composer { width: 784px; margin: 0 auto; background: var(--card); border: var(--bw) var(--bs) var(--line); }
    #chatScroller { margin-top: 24px; border-bottom: 0; border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
    #composer { margin-bottom: 24px; border-top: 0; border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }
    #chatBar { background: var(--card); box-shadow: 0 -2px 0 var(--card); }
  }
