/* Rozmowa: the history column, the messages, the composer and its narrow layouts (linked after
   workspace.css in index.html, before viewer.css and widgets.css). */

/* Rozmowa: the history column, one chat column, the composer (old styles.css). */
.chat-layout { display: flex; height: 100%; min-height: 0; position: relative; }
.history { width: 0; flex: 0 0 0; min-width: 0; overflow: hidden; visibility: hidden; background: var(--panel); transition: width .3s var(--ease), flex-basis .3s var(--ease), visibility 0s .3s; }
.history.open { width: 244px; flex-basis: 244px; visibility: visible; transition: width .3s var(--ease), flex-basis .3s var(--ease), visibility 0s; }
.history-inner { width: 244px; height: 100%; border-right: 1px solid var(--line); padding: 21px 14px; display: flex; flex-direction: column; opacity: 0; transform: translateX(-20px); transition: opacity .2s, transform .3s var(--ease); }
.history.open .history-inner { opacity: 1; transform: none; }
.history-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 3px 16px; }
.history-heading h2 { font: 550 17.2px/1.3 var(--sans); }
.history .history-search { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: #eeece580; color: var(--muted); }
.history .history-search:focus-within { outline: 2px solid var(--olive); border-color: var(--line); }
.history .history-search input { background: none; border: 0; outline: 0; min-width: 0; width: 100%; font-size: 13.5px; }
.history .history-search input:focus-visible { box-shadow: none; }
.history-items { margin-top: 20px; overflow: auto; scrollbar-width: thin; min-height: 0; }
.history-group { margin: 14px 8px 6px; font: 600 11.5px/1.4 var(--sans); color: var(--muted); letter-spacing: .02em; }
.history-group:first-child { margin-top: 4px; }
.history-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 8px; text-align: left; border-radius: 6px; font-size: 13.5px; color: #60694f; transition: background .2s, color .2s; }
.history-row > span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row .icon { width: 16px; height: 16px; flex-shrink: 0; }
.history-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--olive); }
/* A conversation with something unread (task #183): its icon filled with the panel's green, its
   title darker and a little heavier. No background: only the open row has one. (The dot above
   is the thread panel's.) */
.history-row.is-new { color: var(--ink); font-weight: 550; }
.history-row.is-new > .icon { color: var(--olive); fill: currentColor; }
.history-row:hover { background: #dbddd280; color: var(--ink); }
.history-row.active { background: #dbddd2; color: var(--ink); }
.history .history-empty { font-size: 13.5px; line-height: 1.8; color: var(--muted); padding: 4px 7px; }
/* A conversation's menu (ADR 0170: pin, archive, delete): its row's "…", shown on hover and focus
   and while its menu is open (always on touch). */
.history-item { position: relative; display: flex; align-items: center; border-radius: 6px; }
.history-item .history-row { flex: 1; min-width: 0; padding-right: 38px; }
.history-more { position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 30px; height: 30px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.history-item:hover .history-more, .history-item:focus-within .history-more, .history-more[aria-expanded="true"] { opacity: 1; }
.history-more:hover, .history-more[aria-expanded="true"] { color: var(--ink); background: #d3d6c8; }
@media (hover: none) { .history-more { opacity: 1; } }
/* The menu itself: by its button, over the column (fixed: the list that scrolls would cut it). */
.row-menu { position: fixed; z-index: 45; min-width: 184px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 35px #292b2717; transform-origin: top right; }
.row-menu[hidden] { display: none; }
.row-menu--up { transform-origin: bottom right; }
.row-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 6px; font-size: 13.5px; color: var(--ink); text-align: left; }
.row-menu-item .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.row-menu-item:hover, .row-menu-item:focus-visible { background: var(--hover); outline: none; }
.row-menu-item.danger, .row-menu-item.danger .icon { color: var(--danger); }
.row-menu-item.danger:hover, .row-menu-item.danger:focus-visible { background: var(--danger-bg); }
.row-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
/* "Usunąć rozmowę na zawsze?": what goes, the name to type, the two buttons. */
dialog.delete-dialog { width: min(440px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 20px 80px color-mix(in srgb, var(--ink) 16%, transparent); }
dialog.delete-dialog[open] { display: grid; gap: 12px; animation: q-pop 180ms var(--ease) both; }
dialog.delete-dialog::backdrop { background: color-mix(in srgb, var(--ink) 38%, transparent); }
.delete-dialog h2 { font: 400 22px/1.25 var(--serif); letter-spacing: -.3px; }
.delete-dialog p { font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }
.delete-dialog .delete-type { font-weight: 550; }
.delete-dialog .delete-error { color: var(--danger); font-weight: 550; }
.delete-dialog .delete-error[hidden] { display: none; }
.delete-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { dialog.delete-dialog[open] { animation: none; } }
/* Many conversations selected (ADR 0171): a selected row takes the selection's colour, rising
   faster than it falls (ADR 0156); a row's words are not selected as text (so the text
   selection's own paint is off in a row, and the rows' colour is read above them), and a held
   touch opens no menu of the browser's. While a slide goes, no row's button shows under the
   pointer. */
.history-items { --row-selected: var(--selection); }
.history-item { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; --selection: transparent; }
.history-items .history-item.selected .history-row { background: var(--row-selected); color: var(--ink); transition: background .12s, color .12s; }
.history-items.sliding { cursor: default; }
.history-items.sliding .history-item > button { opacity: 0; }
/* Its bar lies over the column's foot, where the link to Archiwum stands: the foot keeps one
   height with the link and with the bar, so the list's box never changes and no row moves when
   the bar comes or goes. A long sentence (what could not be archived) grows the bar upwards,
   over the list's last rows, never the list. */
.history { --history-foot: 70px; }
.history-inner { position: relative; }
.history-archive-link { min-height: var(--history-foot); box-sizing: border-box; }
.history.selecting .history-archive-link { visibility: hidden; }
.history-select { position: absolute; left: 14px; right: 14px; bottom: 21px; min-height: var(--history-foot); box-sizing: border-box; padding: 10px 8px 2px; border-top: 1px solid var(--line); background: var(--panel); }
.history-select-words { font-size: 13.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.history-select-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.history-select-actions[hidden], .history-select-actions [hidden] { display: none; }
/* (With nothing selected it is in the page and out of sight: its status is heard from the first
   selection on.) */
.history-select.is-empty { position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); }
@media (hover: none) {
  .history { --history-foot: 80px; }
  .history-select-actions .btn { min-height: 36px; padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) { .history-row, .history-items .history-item.selected .history-row { transition: none; } }
.history-archive-link { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 14px 8px 2px; border-top: 1px solid var(--line); font-size: 13.5px; color: #60694f; }
.history-archive-link:hover { color: var(--ink); }
.history-archive-link .icon { width: 16px; height: 16px; }
.archived-note { list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 22px 0 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; color: #60694f; font-size: 13.5px; }
.archived-note p { flex: 1; min-width: 200px; margin: 0; }
.archived-note .icon { width: 16px; height: 16px; flex-shrink: 0; }
.history-shade { display: none; }
.chat-view { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; min-height: 0; padding: 0 40px; }
/* The home stands in the middle of the page area, raised by the room kept under it (--home-foot).
   Two spacers hold it there, not centring: a centred column that does not fit loses its top,
   where no scroll reaches (task #157). Under a banner or in a low window the room under it
   gives way first, the heading keeps its gap, and the rest scrolls with the page. */
.chat-view.empty { --home-foot: clamp(40px, 12vh, 130px); }
.chat-view.empty::before { content: ''; flex: 1 1 0px; min-height: 24px; }
.chat-view.empty::after { content: ''; flex: 1 1 var(--home-foot); min-height: 16px; }
.welcome { max-width: 800px; width: 100%; margin: 0 auto 32px; text-align: center; animation: q-enter .4s var(--ease); }
.welcome[hidden] { display: none; }
.welcome h1 { font: clamp(43px, 4.2vw, 65px)/1.04 var(--serif); font-weight: 400; letter-spacing: -2.2px; overflow-wrap: break-word; color: var(--ink); }
.conversation { width: 100%; max-width: 1160px; margin: 0 auto; flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.chat-view.empty .conversation { flex: 0 0 auto; overflow: visible; max-width: 800px; }
.messages { flex: 1; min-height: 0; margin: 0; padding: 30px 5px 20px; list-style: none; display: flex; flex-direction: column; gap: 26px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c9cdbd transparent; }
.chat-view.empty .messages { display: none; }
.message-row { width: 100%; display: flex; animation: message-in 160ms ease-out both; }
.message-row--settled { animation: none; }
/* A conversation opened fades in, already at its end (task #80). */
.messages.is-arriving { animation: q-fade-in 180ms ease-out both; }
.message-row--user { justify-content: flex-end; }
.message-bubble { position: relative; min-width: 72px; padding: 4px 3px; max-width: 100%; width: 100%; }
.message-row--user .message-bubble { background: #e0e5d5; border: 1px solid #d4ddc5; border-radius: 10px 10px 2px 10px; padding: 13px 16px; color: #4b5838; max-width: min(85%, 640px); width: auto; }
.message-row--assistant .message-bubble { color: #505c42; max-width: min(100%, 760px); }
.message-flow { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.message-text { font-size: 15.5px; line-height: 1.85; overflow-wrap: anywhere; min-width: 0; }
.message-text--plain { white-space: pre-wrap; margin: 0; }
.message-text:empty { display: none; }
.message-heading { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; font-size: 14px; font-weight: 550; color: var(--ink); }
.message-heading .symbol { width: 25px; height: 25px; color: var(--olive); flex-shrink: 0; overflow: visible; }
.message-row--assistant .message-text { line-height: 1.9; color: #59634d; }
.message-text > * { margin: 0; }
.message-text > * + * { margin-top: .85em; }
.message-text :is(h1, h2, h3) { font: 400 24px/1.3 var(--serif); letter-spacing: -.015em; color: var(--ink); margin: 1.1em 0 .5em; text-wrap: balance; }
.message-text > :is(h1, h2, h3):first-child { margin-top: 2px; }
.message-text :is(h4, h5, h6) { font-size: 1em; font-weight: 650; color: var(--ink); margin: 1em 0 .5em; }
.message-text :is(ul, ol) { padding-left: 1.35em; }
.message-text li { padding-left: .08em; margin: 0; }
.message-text li + li { margin-top: .35em; }
.message-text li.task { list-style: none; margin-left: -1.1em; }
.message-text strong { font-weight: 650; color: #3f4733; }
.message-text a { color: var(--olive); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; }
.message-text a:hover { text-decoration-thickness: 2px; }
.message-text code { font: .88em ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; padding: .08em .3em; border-radius: 5px; background: #e5e8dc; color: var(--ink); overflow-wrap: anywhere; }
.message-text pre { padding: 9px 10px; overflow-x: auto; font: .8rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; border: 1px solid var(--line); border-radius: 9px; background: #e5e8dc; color: var(--ink); }
.message-text pre code { background: none; padding: 0; font-size: inherit; }
.message-text blockquote { margin-left: 0; padding: .15em 0 .15em 1em; border-left: 3px solid #a4ae90; color: #5c644f; }
.message-text hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.message-text .table-wrap { max-width: 100%; overflow-x: auto; }
.message-text .md-table { width: auto; min-width: 100%; border-collapse: collapse; font-size: .95em; }
.message-text .md-table :is(th, td) { padding: .5em .75em; border: 1px solid var(--line); vertical-align: top; overflow-wrap: normal; word-break: normal; min-width: 6ch; text-align: left; }
.message-text .md-table th { background: var(--sage); font: 600 1em/1.5 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink); }
.message-text img { max-width: 100%; }
.stream-fragment { animation: stream-reveal 180ms ease-out both; }
.message-file-link { display: inline-flex; align-items: baseline; gap: 4px; text-decoration: none !important; }
.message-file-link .icon { align-self: center; }
.message-meta { min-height: 20px; display: flex; align-items: center; gap: 7px; line-height: 1; font-size: 12px; margin-top: 16px; color: #5f6552; }
.message-row--user .message-meta { justify-content: flex-end; margin-top: 10px; }
.message-row--queued .message-bubble { opacity: 0.72; border-style: dashed; }
.message-queued { margin: 8px 0 0; font-size: 12px; color: #6b7558; }
.copy-button { height: 20px; line-height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 5px; font-size: 12px; color: var(--muted); }
.message-meta time:empty { display: none; }
.message-meta .copy-button:first-child { margin-left: -6px; }
.copy-button:hover { background: var(--sage); color: var(--ink); }
/* A quote's and a code block's own Kopiuj (task #179, `block-copy.js`): at the block's top
   right, its first lines flowing beside it; a code block or a table that begins a quote
   (also as its list's first item) stands under the quote's button, at its whole width. Its word is drawn here, from its word
   element's `data-word`: the button adds no text to the answer. While the answer is written
   its place is held (`is-held`). `.copy-plain`: a quote's copy laid out off screen while its
   plain text is read, its list markers written out. */
.block-copy { float: right; display: inline-flex; align-items: center; gap: 5px; height: 22px; margin: 3px 0 3px 12px; padding: 0 7px; border-radius: 5px; font: 400 12px/1 var(--sans); letter-spacing: 0; white-space: nowrap; color: var(--muted); user-select: none; --selection: transparent; }
.block-copy-word::after { content: attr(data-word); }
.block-copy .icon { width: 13px; height: 13px; }
.block-copy:hover { background: #d3dac5; color: var(--ink); }
.block-copy.is-held { visibility: hidden; }
.block-copy + :is(pre, .table-wrap), .block-copy + :is(ol, ul) > li:first-child > pre:first-child { clear: right; }
.copy-plain { position: fixed; left: -10000px; top: 0; width: 640px; }
.copy-marker { white-space: pre; }
.chat-cite { white-space: nowrap; margin-left: 2px; }
.chat-cite a, .chat-cite span[data-cite] { display: inline-block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--sage) 70%, transparent); color: var(--olive-ink) !important; font: 500 .74em/1.65 var(--sans) !important; text-decoration: none !important; cursor: pointer; }
.chat-cite a:hover, .chat-cite a:focus-visible, .chat-cite span[data-cite]:hover { background: var(--sage); color: var(--ink) !important; outline: none; }

/* While Quartio works: the steps under the heading and the working line (old response-stream). */
.tool-activity { max-width: 100%; margin: -8px 0 14px; color: #686b60; font-size: 12px; }
.tool-activity[hidden] { display: none; }
.tool-activity summary { cursor: pointer; padding: 6px 0; overflow-wrap: anywhere; width: fit-content; }
.tool-activity summary.tool-activity-live { display: flex; align-items: center; gap: 8px; color: var(--olive-ink); font-weight: 500; }
.tool-activity ul { list-style: none; padding: 4px 0 4px 14px; margin: 0; border-left: 1px solid #dbddd0; }
.tool-activity li { padding: 3px 0; overflow-wrap: anywhere; transition: color 200ms ease; }
.tool-activity [data-status=failed] { color: #98594f; }
.tool-activity li[data-outcome] { color: var(--muted); }
.tool-activity-mark { display: inline-block; width: 1.2em; color: var(--olive); }
.tool-activity [data-status=failed] .tool-activity-mark { color: var(--muted); }
.tool-activity-mark .q-spinner { width: .85em; height: .85em; border-width: 1.5px; }
.tool-activity-spinner { width: 11px; height: 11px; border-width: 1.5px; }
.tool-activity-detail { color: var(--ink); }
a.tool-activity-detail { color: var(--olive-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--olive) 45%, transparent); text-underline-offset: 2px; }
.tool-activity li.tool-activity-running > span:last-child, .writing-status { background: linear-gradient(100deg, #2c3328 0%, #2c3328 38%, #b7c296 47%, #eef1e4 50%, #b7c296 53%, #2c3328 62%, #2c3328 100%); background-size: 260% 100%; background-clip: text; -webkit-background-clip: text; color: transparent; animation: writing-shimmer 1.6s linear infinite; }
.tool-activity li.tool-activity-running > span:last-child { background-image: linear-gradient(100deg, #3d4436 0%, #3d4436 38%, #b7c296 47%, #eef1e4 50%, #b7c296 53%, #3d4436 62%, #3d4436 100%); }
.writing-copy { display: flex; align-items: center; gap: 10px; font: 400 15px/1.6 var(--sans); color: var(--olive); min-height: 24px; }
.message-text + .writing-copy { margin-top: 14px; }
.writing-copy[hidden] { display: none; }
.writing-spinner { width: 15px; height: 15px; border-width: 2px; }
.writing-status { display: inline-block; font-weight: 500; }
.writing-elapsed { font: 400 12.5px/1 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes writing-shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes stream-reveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes message-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* A write waiting for the person (old action card). */
.message-cards:empty, .message-files:empty { display: none; }
.action-card { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 16px 18px; animation: q-enter 220ms var(--ease) both; color: var(--ink); }
/* A write that reaches people outside the company, and exactly what a write sends (ADR 0079). */
.action-outside { display: flex; align-items: center; gap: 7px; margin: 6px 0 8px; padding: 6px 10px; border-radius: 7px; background: var(--danger-bg); color: var(--danger); font-size: 12.5px; font-weight: 550; line-height: 1.4; }
.action-outside .icon { flex: none; }
.action-card--outside { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); box-shadow: inset 3px 0 0 var(--danger); }
.action-preview-open { margin: 2px 0 8px; font-size: 12.5px; color: var(--olive-ink); text-decoration: underline; text-underline-offset: 3px; }
dialog.action-preview { width: min(680px, calc(100vw - 32px)); max-height: min(86vh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px #292b2733; overflow: hidden; }
dialog.action-preview[open] { display: flex; flex-direction: column; animation: q-pop 180ms var(--ease) both; }
dialog.action-preview::backdrop { background: #292b2740; }
.action-preview-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 0; }
.action-preview-head .eyebrow { margin: 0; }
.action-preview-content { padding: 6px 18px 18px; overflow: auto; display: grid; gap: 10px; }
.action-preview-title { font: 24px/1.2 var(--serif); margin: 0; }
.action-preview-summary { margin: 0; font-size: 14px; line-height: 1.6; }
.action-fields, .action-all-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 13px; }
.action-fields dt, .action-all-list dt { color: var(--muted); }
.action-fields dd, .action-all-list dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.action-body-label { margin: 4px 0 6px; font-size: 12px; color: var(--muted); }
.action-body { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; max-height: 50vh; overflow: auto; }
.action-body--text { white-space: pre-wrap; }
.action-link { text-decoration: underline; text-underline-offset: 2px; }
.action-all summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.action-all-list { margin-top: 8px; font-size: 12.5px; max-height: 30vh; overflow: auto; }
.action-key { display: block; font-size: 11.5px; opacity: .8; }
.action-card .eyebrow { display: block; margin-bottom: 6px; font: 600 11.1px/1.55 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.action-card-what { font: 500 15px/1.55 var(--sans); color: var(--ink); margin: 0; overflow-wrap: anywhere; }
.action-card-kind { font: 400 13px/1.5 var(--sans); color: var(--muted); margin: 6px 0 0; overflow-wrap: anywhere; }
.action-card-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.action-card-status { margin: 0 auto 0 0; font-size: 13px; color: var(--muted); }
.action-card-status:empty { display: none; }
.action-card .button, .action-together .button { height: 36px; padding: 0 14px; border-radius: 7px; font: 500 13.5px/1 var(--sans); }
.action-card .button.dark, .action-together .button.dark { background: var(--ink); color: var(--surface); }
.action-card .button.dark:hover:not(:disabled), .action-together .button.dark:hover:not(:disabled) { background: var(--ink-hover); color: #fff; }
.action-card .button.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.action-card .button.secondary:hover:not(:disabled) { background: var(--hover); }
.action-card.decided .action-card-footer { margin-top: 10px; }
.action-card.applied { border-color: color-mix(in srgb, var(--olive) 35%, var(--line)); }
.action-card.applied .action-card-status { color: var(--olive-ink); font-weight: 550; }
.action-card.rejected { opacity: .8; }
.action-card.failed { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.action-card.failed .action-card-status { color: var(--danger); font-weight: 550; }
/* One press for the writes that wait together (ADR 0149), under the last of them. */
.action-together { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.action-together-note, .action-together .action-card-status { margin: 0; font-size: 13px; color: var(--muted); }
.action-together-note { margin-right: auto; }
.action-together-note:empty, .action-together .action-card-status:empty { display: none; }
.action-card.just-settled { animation: q-card-settle 600ms var(--ease); }
.action-card.just-settled .action-card-status::before { content: '✓'; display: inline-block; margin-right: 6px; animation: q-check-pop 340ms var(--ease) both; }
.action-card.just-settled.rejected .action-card-status::before, .action-card.just-settled.failed .action-card-status::before { content: '×'; }
@keyframes q-check-pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes q-card-settle { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--olive) 35%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* Files in a conversation as cards (ADR 0062): a thumbnail of what the file is (made when the
   card comes into view, faded in), its badge, name, kind and size; a click opens the viewer, the
   arrow downloads. */
.message-attachments { margin: 2px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; list-style: none; }
.message-attachment { position: relative; min-width: 0; display: flex; flex-direction: column; border: 1px solid #d4dac7; border-radius: 12px; background: #f6f7f1; color: var(--ink); overflow: hidden; animation: q-pop 160ms var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); transition: border-color .15s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease); }
.message-attachment--downloadable:hover { border-color: #c0c8b0; box-shadow: 0 6px 18px #292b2714; transform: translateY(-1px); }
.attachment-download { width: 100%; min-width: 0; padding: 0; display: flex; flex-direction: column; align-items: stretch; color: inherit; text-align: left; border-radius: 0; }
.attachment-download:hover { background: none; color: inherit; }
/* The card clips what stands outside it and its picture would cover a ring drawn inside: the
   keyboard's focus ring is the card's own. */
.attachment-download:focus-visible { outline: none; }
.message-attachment:has(> .attachment-download:focus-visible) { outline: 2px solid var(--olive); outline-offset: 2px; }
/* A thumbnail is a picture of the file, also where it is drawn from the file's own words: no
   text in it is selected (by the pointer, or with everything around it), and no highlight of a
   selection paints it (ADR 0156: `--selection`). The name and the size under it stay text. */
.attachment-thumb { position: relative; height: 104px; overflow: hidden; display: grid; place-items: center; background: #eceee4; border-bottom: 1px solid #e1e5d6; user-select: none; -webkit-user-select: none; --selection: transparent; }
.attachment-thumb--doc { background: #e4e9ec; }
.attachment-thumb--slides { background: #efe8da; }
.attachment-thumb--pdf { background: #efe5df; }
.attachment-thumb .attachment-icon { width: 40px; height: 40px; border-radius: 10px; font-size: .8rem; }
.attachment-thumb > :not(.attachment-icon) { position: absolute; inset: 0; animation: q-fade-in .25s var(--ease) both; }
.thumb-picture { width: 100%; height: 100%; object-fit: cover; object-position: top center; background: #fff; }
.thumb-page { display: flex; flex-direction: column; gap: 3px; margin: 10px 14px 0; padding: 10px 12px; background: #fff; border-radius: 2px; box-shadow: 0 1px 3px #292b271f; font-size: 6.5px; line-height: 1.35; color: #55584d; overflow: hidden; }
.thumb-page strong { font-size: 8.5px; color: #292b27; }
.thumb-page span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.thumb-page--mono { font-family: ui-monospace, monospace; }
.thumb-grid { margin: 10px 10px 0; background: #fff; border-radius: 2px; box-shadow: 0 1px 3px #292b271f; font-size: 7px; overflow: hidden; }
.thumb-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid #ebe9e1; }
.thumb-row span { padding: 2px 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-right: 1px solid #ebe9e1; }
.thumb-head { background: #f5f4ef; font-weight: 600; }
.thumb-slide { margin: 12px auto 0; overflow: hidden; border-radius: 2px; box-shadow: 0 1px 3px #292b271f; }
.thumb-slide .slide { transform-origin: 0 0; }
.attachment-thumb.has-thumb .attachment-icon { visibility: hidden; }
.attachment-meta { display: grid; gap: 2px; padding: 9px 40px 10px 10px; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 600; }
.attachment-size { color: var(--muted); font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-save { position: absolute; right: 6px; bottom: 9px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; transition: background 140ms ease, color 140ms ease; }
.attachment-save:hover, .attachment-save:focus-visible { background: #e3e9d8; color: var(--ink); }
.message-attachment--missing { opacity: .6; }
.attachment-icon { display: grid; place-items: center; color: var(--olive); font-weight: 700; background: var(--sage); }
.message-text + .message-attachments, .message-files .message-attachments { margin-top: 12px; }

/* The composer (old .composer grid) and the files tray joined to its top edge. */
.composer-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 8px 0 22px; flex-shrink: 0; position: relative; z-index: 6; }
.chat-view.empty .composer-wrap { max-width: 800px; padding-bottom: 0; }
:is(.chat-view, .sa-composer) .composer { display: grid; grid-template-columns: 32px minmax(0, 1fr) 34px 34px; gap: 8px; align-items: center; min-height: 134px; margin: 0; padding: 17px 17px 12px; border: 1px solid #cbcdbd; border-radius: 12px; background: var(--surface); box-shadow: 0 4px 18px #393b2910; transition: border-color .3s, box-shadow .3s; }
:is(.chat-view, .sa-composer) .composer:focus-within { border-color: #939f78; box-shadow: 0 5px 24px #51583712; }
:is(.chat-view, .sa-composer) .composer textarea { grid-column: 1 / -1; grid-row: 1; display: block; width: 100%; height: auto; min-height: 64px; max-height: 150px; resize: none; overflow: auto; background: none; border: 0; outline: 0; box-shadow: none; padding: 1px 0; font: 16px/1.75 var(--sans); color: #484c3d; }
:is(.chat-view, .sa-composer) .composer textarea::placeholder { color: #777d6b; }
:is(.chat-view, .sa-composer) .composer textarea:focus-visible { box-shadow: none; outline: 0; }
.attach-button { grid-column: 1; grid-row: 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.attach-button .icon { width: 22px; height: 22px; stroke-width: 1.5; }
.attach-button:hover { background: var(--sage); }
.stop-button { grid-column: 3; grid-row: 2; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--sage); color: var(--ink); animation: q-pop 160ms var(--ease) both; }
.stop-button[hidden] { display: none; }
.stop-button:hover { background: #cbd4bc; }
.stop-button .icon { width: 13px; height: 13px; fill: currentColor; }
:is(.chat-view, .sa-composer) .send-button { grid-column: 4; grid-row: 2; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; background: var(--ink); color: #fff; }
:is(.chat-view, .sa-composer) .send-button .icon { width: 20px; height: 20px; stroke-width: 2.3; }
:is(.chat-view, .sa-composer) .send-button:hover:not(:disabled) { background: #66704e; transform: translateY(-1px); }
.attach-button:active, :is(.chat-view, .sa-composer) .send-button:active { transform: scale(.94); }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 176px; overflow-y: auto; scrollbar-width: thin; }
.file-chips:empty { display: none; }
.file-chips:not(:empty) { padding: 10px 12px 8px; border: 1px solid var(--control); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--surface); animation: q-enter 180ms var(--ease) both; }
.file-chips:not(:empty) + .composer { border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: var(--line); box-shadow: 0 8px 18px #393b2910; }
.file-chip { min-width: 0; max-width: 280px; height: 34px; padding: 0 5px 0 10px; display: inline-flex; flex: 0 1 auto; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); color: var(--ink); animation: q-pop 160ms var(--ease) both; }
.file-chip__name, .file-chip__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 600; }
.file-chip__open, .file-chip__label { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.file-chip__open { cursor: pointer; border-radius: 4px; }
.file-chip__open:hover .file-chip__name, .file-chip__open:hover .file-chip__title { text-decoration: underline; text-underline-offset: 2px; }
.file-chip__open:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
/* A page's sheet (task #116): its title and first lines, each up to two lines, no size. */
.file-chip--page { width: 340px; max-width: 100%; height: auto; padding: 8px 5px 8px 12px; align-items: flex-start; }
.file-chip--page .file-chip__open, .file-chip--page .file-chip__label { flex: 1 1 auto; }
.file-chip__line { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); font-size: .74rem; line-height: 1.35; }
.file-chip__size { flex: 0 0 auto; color: var(--muted); font-size: .72rem; }
.file-chip__remove { width: 24px; height: 24px; padding: 0; display: grid; place-items: center; flex: 0 0 auto; color: var(--muted); font-size: 1rem; line-height: 1; border-radius: 7px; }
.file-chip__remove:hover { color: var(--danger); background: #fffef894; }
.file-chip--error { border-color: #d9b3a8; background: var(--danger-soft); color: var(--danger); }
.file-chip--error .file-chip__size { color: var(--danger); }
.file-chip .q-spinner { width: 12px; height: 12px; border-width: 1.5px; }
/* A picture in the box (ADR 0169): a tile of the picture itself, one element from its first
   frame; dimmed under a spinner while its file uploads, then a button that opens the viewer. */
.file-chips:has(.file-chip--picture) { gap: 8px; align-items: center; }
.file-chip--picture { position: relative; width: 72px; height: 72px; max-width: none; padding: 0; flex: 0 0 auto; overflow: hidden; border-color: #d4dac7; border-radius: 10px; background: #eceee4; transition: border-color .15s var(--ease), box-shadow .2s var(--ease); }
.file-chip--picture:not(.uploading):hover { border-color: #c0c8b0; box-shadow: 0 6px 18px #292b2714; }
.file-chip--picture .file-chip__open { width: 100%; height: 100%; display: block; border-radius: 0; }
.file-chip--picture .file-chip__open:disabled { opacity: 1; }
.file-chip--picture .file-chip__open:active { transform: none; }
/* (The tile clips what stands outside it: the keyboard's focus ring is the tile's own.) */
.file-chip--picture .file-chip__open:focus-visible { outline: none; }
.file-chip--picture:has(> .file-chip__open:focus-visible) { outline: 2px solid var(--olive); outline-offset: 2px; }
.file-chip--picture .attachment-thumb { width: 100%; height: 100%; border: 0; }
.file-chip--picture .attachment-icon { width: 30px; height: 30px; border-radius: 8px; font-size: .75rem; }
.file-chip--picture .thumb-picture { object-position: center; }
.file-chip__state { position: absolute; inset: 0; display: none; place-content: center; justify-items: center; gap: 4px; background: #f8f7f2c4; color: var(--ink); font-size: .68rem; font-weight: 600; line-height: 1; pointer-events: none; }
.file-chip--picture.uploading .file-chip__state { display: grid; }
.file-chip--picture .file-chip__state .q-spinner { width: 18px; height: 18px; border-width: 2px; }
/* (A disc of 20 px in a target of 24.) */
.file-chip--picture .file-chip__remove { position: absolute; top: 2px; right: 2px; border-radius: 50%; background: radial-gradient(circle, #292b27c2 0 10px, transparent 10.5px); color: #fff; font-size: .9rem; }
.file-chip--picture .file-chip__remove:hover { background: radial-gradient(circle, var(--danger) 0 10px, transparent 10.5px); color: #fff; }
/* (Its ring inside the disc: the tile clips one drawn around it.) */
.file-chip--picture .file-chip__remove:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.chat-view.drop-target .composer { border-color: var(--olive); box-shadow: 0 0 0 3px var(--sage); }
.chat-starters { display: none; }
.chat-view.empty .chat-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 800px; margin: 14px auto 0; animation: q-enter 260ms var(--ease) both; }
.chat-view.empty .chat-offers[hidden] { display: none; }
.chat-suggestion { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 12px; font-size: 13.5px; line-height: 1.4; color: var(--ink); text-align: center; max-width: 100%; }
.chat-suggestion:hover:not(:disabled) { background: var(--hover); color: var(--ink); border-color: var(--control); }
.new-messages-button { position: absolute; z-index: 4; left: 50%; bottom: 16px; min-height: 34px; padding: 0 14px; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--olive); box-shadow: 0 6px 18px #292b2729; translate: -50% 0; animation: q-pop 160ms var(--ease) both; }
.new-messages-button[hidden] { display: none; }

@media (min-width: 1750px) {
  .chat-view.empty { --home-foot: 14vh; }
  .welcome h1 { font-size: 80px; }
  .welcome { margin-bottom: 52px; }
  .chat-view.empty .composer-wrap, .welcome { max-width: 880px; }
}
@media (max-width: 1200px) {
  .chat-view { padding: 0 30px; }
  .welcome h1 { font-size: 60.3px; letter-spacing: -2px; }
}
@media (max-width: 1050px) {
  .history { position: absolute; inset: 0 auto 0 0; z-index: 30; width: 244px; transform: translateX(-100%); transition: transform .3s var(--ease), visibility 0s .3s; }
  .history.open { transform: none; transition: transform .3s var(--ease), visibility 0s; }
  .history-inner { opacity: 1; transform: none; }
  .history-shade { display: block; visibility: hidden; opacity: 0; position: absolute; inset: 0; background: #3037242e; z-index: 29; transition: opacity .25s, visibility 0s .25s; border: 0; }
  .history.open ~ .history-shade { visibility: visible; opacity: 1; transition: opacity .25s; }
}
@media (max-width: 760px) {
  .chat-view { padding: 0 19px; }
  .chat-view.empty { --home-foot: 12vh; }
  .welcome { margin-bottom: 30px; }
  .welcome h1 { font-size: 48px; line-height: 1.25; letter-spacing: -1.7px; }
  .composer-wrap { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .chat-view .composer { grid-template-columns: 40px minmax(0, 1fr) 40px 40px; min-height: 128px; padding: 15px 13px 10px; }
  .attach-button, .chat-view .send-button, .stop-button { width: 40px; height: 40px; }
  .messages { padding-top: 25px; }
  .message-row--user .message-bubble { max-width: min(93%, 640px); padding: 12px 16px; }
  .message-text, .message-row--assistant .message-text { font-size: 15px; }
  .message-text :is(h1, h2, h3) { font-size: 21px; }
  .history-row { min-height: 44px; }
}

/* Work handed to the background (ADR 0110): under the answer that handed it on, where it stands. */
.message-row--background { padding: 0 3px; }
.bg-card { width: 100%; max-width: min(100%, 560px); margin: -4px 0 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 14px 16px; color: var(--ink); }
.bg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bg-head .eyebrow { font-size: 11px; }
.bg-meta { font-size: 12px; color: var(--muted); }
.bg-track { list-style: none; display: flex; gap: 6px; margin: 10px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.bg-stage { flex: 1; display: flex; align-items: center; gap: 6px; padding-top: 6px; border-top: 2px solid var(--line); transition: border-color 300ms ease, color 300ms ease; }
.bg-stage.is-past, .bg-stage.is-current { border-top-color: var(--olive); }
.bg-stage.is-current { color: var(--ink); font-weight: 500; }
.bg-stage-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none; }
.bg-stage.is-past .bg-stage-dot, .bg-stage.is-current .bg-stage-dot { background: var(--olive); }
.bg-line { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.bg-pulse { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--olive); animation: now-pulse 1.8s ease-in-out infinite; }
.bg-card[data-state="done"] .bg-line { color: var(--olive); font-weight: 500; }
.bg-steps-box { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.bg-steps-box summary { cursor: pointer; width: fit-content; }
.bg-steps { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.bg-hint { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* Reduced motion: nothing moves but the loading rings, which turn slower (pages.css) so a wait
   still reads as one; placeholders keep their late, instant appearance (ADR 0034). */
@media (prefers-reduced-motion: reduce) {
  *:not(.q-spinner):not(.q-placeholder):not(.q-loading), *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  /* The working words without their sweep (old styles.css). */
  .writing-status, .tool-activity li.tool-activity-running > span:last-child { background: none; color: var(--olive); }
}

/* Rozmowa's answer cards (task #148): what the panels do, pressed in the answer. */
.answer-card { display: grid; gap: 10px; margin: 10px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); max-width: 560px; }
.answer-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.answer-card-body:empty { display: none; }
.answer-card-body { display: grid; gap: 8px; }
.answer-card-body > p { margin: 0; }
.answer-card .cx-chat--inline { margin-top: 2px; }
.answer-secret { display: grid; gap: 8px; }
.answer-secret-row { display: flex; gap: 8px; flex-wrap: wrap; }
.answer-secret-row input { flex: 1 1 200px; min-width: 0; }
.answer-secret-done { margin: 0; color: var(--olive); font-weight: 600; }

/* A conversation shared with the person for reading (ADR 0167): no message box, a sentence in
   its place. */
.composer[hidden], .file-chips[hidden], .read-only-note[hidden] { display: none; }
.read-only-note { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0; padding: 15px 17px; border: 1px dashed #cbcdbd; border-radius: 12px; background: var(--surface); font-size: 13.5px; line-height: 1.5; color: var(--muted); text-align: left; }
.read-only-note .icon { flex-shrink: 0; color: var(--olive); }
/* Who only reads opens no new thread: nothing offers one. */
.chat-view.is-read-only :is(.thread-float, .thread-action) { display: none; }
