/* The shell and Rozmowa as in the old product (engine/public styles.css, experience.css,
   loader.css; ADR 0030): its sizes, spacing, colours and motion, on v2's markup. Loaded after
   styles.css; other pages keep their own rules (pages.css). */

:root {
  --olive-ink: #505b37; --soft: #86887c; --raised: #f1f0e9; --control: #cbcdbd; --field: #fffef8;
  --hover: #e9e8e0; --ink-hover: #454c37; --danger-soft: #f6e9e4; --panel: var(--sidebar);
}

/* The loaders and the entrance motion (.q-spinner, .q-loading, .q-enter, .q-pop) are pages.css's. */
.panel-enter { animation: q-enter 200ms var(--ease) both; }
@keyframes view-reveal { from { opacity: .7; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Shell */
.app-shell { height: 100dvh; min-height: 400px; display: flex; overflow: hidden; }
.navigation { width: 224px; flex-shrink: 0; padding: 15px 17px 16px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 35; }
.navigation .wordmark { display: flex; align-items: center; gap: 0; font: 21px/1 var(--serif); width: fit-content; padding: 0 9px 14px; letter-spacing: -.6px; color: var(--ink); }
.navigation .wordmark img { width: 20px; height: 20px; margin-right: 6px; }
.navigation .wordmark > span { color: var(--olive); }
.navigation .new-chat { display: flex; align-items: center; gap: 10px; border-radius: 7px; padding: 11px 13px; margin: 0; text-align: left; font-size: 14.8px; width: 100%; background: var(--ink); color: var(--surface); }
.navigation .new-chat:hover { background: #3a4033; color: #fff; box-shadow: 0 4px 14px #292b2715; }
.new-chat-plus { display: grid; place-items: center; width: 18px; height: 18px; }
.new-chat-plus .icon { width: 18px; height: 18px; stroke-width: 1.7; }
.navigation .nav { display: grid; gap: 3px; margin-top: 11px; }
.navigation .nav-item { width: 100%; display: flex; gap: 11px; align-items: center; padding: 10px 12px; border-radius: 6px; color: #64675b; text-align: left; font-size: 14.8px; position: relative; transition: background .2s, color .2s; }
.navigation .nav-item .icon { width: 18px; height: 18px; }
.navigation .nav-item:hover { background: #dcded150; color: var(--ink); }
.navigation .nav-item.active { background: #d9ddce; color: #454c37; font-weight: 550; }
.navigation .nav-item.active:before { content: ''; position: absolute; left: -17px; height: 20px; width: 3px; background: var(--olive); border-radius: 0 3px 3px 0; }
.account-wrap { margin-top: auto; position: relative; }
.navigation .account { width: 100%; display: flex; gap: 9px; text-align: left; align-items: center; border-top: 1px solid var(--line); padding: 16px 8px 3px; font-size: 13.5px; font-weight: 550; color: var(--ink); border-radius: 0; }
.navigation .account:active { transform: none; }
.navigation .account .who { min-width: 0; flex: 1; }
.navigation .account strong { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navigation .account small { display: block; color: var(--ink); font-size: 11.1px; font-weight: 400; }
.navigation .account .avatar { font-size: 12.3px; }
.navigation .account .settings-icon { margin-left: auto; width: 19px; height: 19px; color: var(--muted); transition: transform .3s var(--ease), color .2s; }
.navigation .account:hover .settings-icon, .navigation .account[aria-expanded=true] .settings-icon { color: var(--ink); transform: rotate(30deg); }
.account-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 35px #292b2717; z-index: 40; transform-origin: bottom left; }
.account-menu[hidden] { display: none; }
.account-menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.account-menu-who strong { display: block; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-who small { font-size: 11.5px; color: var(--muted); }
.account-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; }
.account-menu-item .icon { color: var(--muted); }
.account-menu-item:hover, .account-menu-item:focus-visible { background: var(--hover); color: var(--ink); outline: none; }
.account-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.workspace .topbar { height: 67px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 30px; gap: 20px; }
.topbar-start { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-end { margin-left: auto; position: relative; flex-shrink: 0; }
.history-slot:empty { display: none; }
.back-button[hidden] { display: none; }
.workspace .breadcrumbs { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--muted); font-size: 13.5px; }
.workspace .breadcrumbs .slash { color: #b2b6a7; }
.workspace .breadcrumbs a { color: var(--muted); }
.workspace .breadcrumbs a:hover { color: var(--ink); }
.workspace .breadcrumbs .current { color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; max-width: min(48vw, 480px); }
#page-title[data-renamable] { cursor: text; border-radius: 5px; padding: 2px 4px; margin: -2px -4px; }
#page-title[data-renamable]:hover { background: #dcded180; }
.title-input { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--control); border-radius: 6px; padding: 3px 8px; min-width: min(360px, 50vw); }
.title-input:focus { outline: 0; border-color: var(--olive); box-shadow: 0 0 0 3px var(--sage); }
.icon-button svg { width: 17px; height: 17px; }
.history-toggle:hover, .history-toggle[aria-expanded=true] { background: #d9ddce; color: var(--ink); }
.mobile-menu, .nav-shade { display: none; }
.workspace .page { flex: 1; min-width: 0; min-height: 0; overflow: auto; position: relative; outline: 0; scrollbar-width: thin; scrollbar-color: #c9cdbd transparent; animation: view-reveal 200ms var(--ease); }

/* Aktywność in the header (old activity.js). */
.activity-trigger { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); transition: background-color 160ms ease, color 160ms ease; padding: 7px 11px; font-size: 12px; }
.activity-trigger:hover { background: var(--hover); color: var(--ink); }
.activity-trigger.is-running { color: var(--ink-hover); border-color: var(--control); }
.activity-panel { position: absolute; right: 0; top: calc(100% + 12px); width: min(360px, calc(100vw - 32px)); max-height: min(70vh, 580px); overflow: auto; z-index: 40; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transform-origin: top right; box-shadow: 0 12px 35px #292b2717; }
.activity-panel[hidden] { display: none; }
.activity-panel h2 { font: 400 25px var(--serif); margin: 0 0 12px; }
.activity-panel p { font-size: 13px; color: var(--muted); }
.activity-item { display: grid; gap: 4px; padding: 11px 8px; margin: 0 -8px; border-top: 1px solid var(--line); border-radius: 6px; color: var(--ink); transition: background-color 160ms ease; }
.activity-item:hover { background: color-mix(in srgb, var(--sage) 40%, transparent); }
.activity-item strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.activity-state, .activity-item time { font-size: 11px; color: var(--muted); }
.activity-state--waiting { color: #86622b; }
.activity-state--failed, .activity-state--interrupted { color: var(--danger); }
.activity-state--running { color: var(--olive); }
@media (max-width: 440px) { .activity-trigger { max-width: 104px; padding: 7px 8px; } .activity-panel { right: -6px; } }

/* Administracja: the admin pages as one quiet list. */
.page-heading { margin: 0 0 28px; }
.page-heading .eyebrow { display: block; font: 600 11px/1.55 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.page-heading h1 { font: 400 clamp(38px, 3.8vw, 54px)/1.05 var(--serif); letter-spacing: -1.2px; margin: 0; color: var(--ink); }
.page-heading p { font: 400 14px/1.7 var(--sans); color: var(--muted); margin: 12px 0 0; }
.admin-list { display: grid; }
.admin-row { display: flex; align-items: center; gap: 14px; padding: 14px 10px; margin: 0 -10px; border-top: 1px solid var(--line); border-radius: 6px; color: var(--ink); transition: background-color 160ms ease; }
.admin-row:first-child { border-top: 0; }
.admin-row:hover { background: color-mix(in srgb, var(--sage) 40%, transparent); }
.admin-row > .icon { color: var(--olive); }
.admin-row-text { flex: 1; min-width: 0; }
.admin-row-text strong { display: block; font-size: 14.8px; font-weight: 550; }
.admin-row-text small { display: block; font-size: 12.3px; color: var(--muted); margin-top: 2px; }
.admin-row-arrow { transform: rotate(180deg); color: var(--muted); transition: transform .2s var(--ease); }
.admin-row:hover .admin-row-arrow { transform: rotate(180deg) translateX(-3px); }

@media (max-width: 1200px) {
  .navigation { width: 205px; padding: 15px 14px 16px; }
  .navigation .nav-item.active:before { left: -14px; }
}
@media (max-width: 760px) {
  .navigation { position: fixed; inset: 0 auto 0 0; width: 228px; z-index: 50; transform: translateX(-100%); visibility: hidden; transition: transform .3s var(--ease), visibility 0s .3s; }
  .nav-open .navigation { visibility: visible; transform: none; transition: transform .3s var(--ease), visibility 0s; }
  .nav-shade { display: block; position: fixed; inset: 0; background: #29301f50; z-index: 49; visibility: hidden; opacity: 0; transition: opacity .3s, visibility 0s .3s; border: 0; }
  .nav-open .nav-shade { visibility: visible; opacity: 1; transition: opacity .3s; }
  .mobile-menu { display: inline-grid; }
  .workspace .topbar { height: 59px; padding: 0 16px; gap: 12px; }
  .workspace .breadcrumbs { gap: 10px; }
  .workspace .breadcrumbs .crumb-root, .workspace .breadcrumbs .crumb-root + .slash { display: none; }
}

/* 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-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; }
.history-shade { display: none; }
.chat-view { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; min-height: 0; padding: 0 40px; }
.chat-view.empty { justify-content: center; padding-bottom: clamp(40px, 12vh, 130px); }
.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); }
.welcome h1 .welcome-brand { color: #71785d; }
.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; }
.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; }
.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; }
.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); }
.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); }
.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-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 { height: 36px; padding: 0 14px; border-radius: 7px; font: 500 13.5px/1 var(--sans); }
.action-card .button.dark { background: var(--ink); color: var(--surface); }
.action-card .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.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 { 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 of a message, and the agent's files under its answer (old message-attachments). */
.message-attachments { margin: 2px 0 4px; padding: 0; display: grid; gap: 6px; list-style: none; }
.message-text + .message-attachments, .message-files .message-attachments { margin-top: 12px; }
.message-attachment { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid #d4dac7; border-radius: 11px; background: #f0f2e8; color: var(--ink); animation: q-pop 160ms var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.message-attachment--missing { opacity: .6; }
.message-attachment--missing .attachment-download:hover { background: none; }
.attachment-save { width: 34px; height: 34px; margin-right: 5px; display: grid; place-items: center; color: var(--muted); border-radius: 9px; transition: background 140ms ease, color 140ms ease; }
.attachment-save:hover, .attachment-save:focus-visible { background: #e3e9d8; color: var(--ink); }
.attachment-download { width: 100%; min-width: 0; min-height: 44px; padding: 8px 9px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; color: inherit; text-align: left; border-radius: 10px; transition: background 140ms ease; }
.attachment-download:hover { background: #e3e9d8; color: inherit; }
.attachment-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--olive); font-size: .7rem; font-weight: 700; border-radius: 9px; background: var(--sage); }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; font-weight: 600; }
.attachment-size { color: var(--muted); font-size: .68rem; }

/* 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; }
.chat-view .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; }
.chat-view .composer:focus-within { border-color: #939f78; box-shadow: 0 5px 24px #51583712; }
.chat-view .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; }
.chat-view .composer textarea::placeholder { color: #777d6b; }
.chat-view .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; }
.chat-view .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; }
.chat-view .send-button .icon { width: 20px; height: 20px; stroke-width: 2.3; }
.chat-view .send-button:hover:not(:disabled) { background: #66704e; transform: translateY(-1px); }
.attach-button:active, .chat-view .send-button:active { transform: scale(.94); }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 96px; 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 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 600; }
.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; }
.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-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; transform: translateX(-50%); animation: q-pop 160ms var(--ease) both; }
.new-messages-button[hidden] { display: none; }

/* The file preview (old attachment-preview). */
dialog.attachment-preview { width: min(1400px, calc(100vw - 64px)); max-width: 100%; max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 20px 80px #252c1c26; overflow: auto; }
dialog.attachment-preview[open] { animation: q-enter .22s var(--ease); }
dialog.attachment-preview::backdrop { background: #292b2766; backdrop-filter: blur(3px); }
.attachment-preview .dialog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.attachment-preview h2 { font: 500 18px/1.4 var(--sans); overflow-wrap: anywhere; }
.attachment-preview-body { padding: 20px 24px; min-height: 100px; max-height: calc(100dvh - 230px); overflow: auto; }
.attachment-preview-footer { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.attachment-preview-footer .button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 7px; background: var(--ink); color: var(--surface); font-size: 14px; }
.attachment-preview-footer .button:hover { background: var(--ink-hover); }
.preview-media { display: block; max-width: 100%; margin: auto; border: 0; }
img.preview-media, video.preview-media { max-height: calc(100dvh - 280px); object-fit: contain; }
iframe.preview-media { width: 100%; height: 65dvh; background: #fff; }
.preview-text { white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.6 ui-monospace, monospace; margin: 0; }
.dialog-meta { font-size: 13px; color: var(--muted); }
.text-button { display: inline-flex; gap: 8px; align-items: center; padding: 9px 0; margin-top: 8px; color: #6c7c50; font-size: 13.5px; }

@media (min-width: 1750px) {
  .chat-view.empty { padding-bottom: 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 { padding-bottom: 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; }
  .attachment-preview-body { padding: 14px; }
  .attachment-preview .dialog-header { padding: 14px; }
}

/* 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); }
}
