/* The chat: a list of chats and one thread, like ChatGPT, in the OfficeX style. */
body.chat-open main.frame { padding: 0; min-height: 0; max-width: none; border: 0; }
/* The navbar lines up with the sidebar: the logo over the list, the tabs over the thread. */
body.chat-open .top .wrap { max-width: none; padding: 0 18px; }
body.chat-open .top .logo { min-width: 222px; }
.chat { display: grid; grid-template-columns: 268px minmax(0, 1fr); height: calc(100dvh - 65px); }
.chat-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--soft); }
.chat-new { padding: 8px 8px 4px; }
.chat-new button { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 10px; font: 500 14px var(--font); color: var(--ink); cursor: pointer; }
.chat-new button:hover { background: var(--line); }
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px; }
.chat-item { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.chat-item button.open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 9px 10px; font: 14px var(--font); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.chat-item.on, .chat-item:hover { background: var(--line); }
.chat-item .del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; visibility: hidden; }
.chat-item:hover .del, .chat-item.on .del { visibility: visible; }
.chat-foot { border-top: 1px solid var(--line); padding: 12px 14px; font-size: 12px; color: var(--muted); display: grid; gap: 8px; }
.chat-foot .meter-line { display: flex; justify-content: space-between; gap: 8px; }
.chat-foot button { background: #fff; border: 1px solid var(--line); padding: 7px 10px; cursor: pointer; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--ink); }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread { flex: 1; overflow-y: auto; padding: 28px 20px 12px; }
.thread > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.msg { margin-bottom: 20px; line-height: 1.6; overflow-wrap: anywhere; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user div { background: var(--soft); border-radius: 16px; padding: 10px 16px; max-width: 80%; white-space: pre-wrap; }
.msg.ai p { margin: 0 0 10px; }
.msg.ai h1, .msg.ai h2, .msg.ai h3 { font-size: 17px; margin: 14px 0 6px; }
.msg.ai ul, .msg.ai ol { margin: 0 0 10px; padding-left: 22px; }
.msg.ai pre { background: #161616; color: #d4d4d4; padding: 12px; border-radius: 6px; overflow-x: auto; font: 13px var(--mono); }
.msg.ai code { font: 13px var(--mono); background: var(--soft); padding: 1px 4px; border-radius: 4px; }
.msg.ai pre code { background: none; padding: 0; color: inherit; }
.step { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.action { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.action .t { font-weight: 600; text-transform: capitalize; }
.action .why { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.action pre { background: var(--soft); padding: 10px; font: 12px var(--mono); overflow-x: auto; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.action .row2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.composer { padding: 10px 20px 14px; }
.composer form { max-width: 760px; margin: 0 auto; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; background: #fff; }
.composer textarea { width: 100%; min-height: 3.2em; line-height: 1.6; border: 0; outline: 0; resize: none; font: 16px var(--font); max-height: 200px; background: none; }
.composer .row2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.composer label { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.composer .spacer { flex: 1; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tray:empty { display: none; }
.att { position: relative; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px; overflow: hidden; font-size: 10px; color: var(--muted); }
.att img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att svg { width: 20px; height: 20px; flex: none; }
.att span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .rm { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; line-height: 16px; padding: 0; border: 0; border-radius: 50%; background: rgba(15, 15, 15, .75); color: #fff; font-size: 13px; cursor: pointer; }
.clip { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: none; border: 0; border-radius: 8px; color: var(--muted); cursor: pointer; padding: 0; }
.clip:hover { background: var(--soft); color: var(--ink); }
.clip svg { width: 18px; height: 18px; }
.composer form.drop { border-color: var(--brand); }
.msg.user { flex-direction: column; align-items: flex-end; gap: 6px; }
.msg.user .files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; background: none; padding: 0; max-width: 100%; }
.chat-empty { text-align: center; padding-top: 16vh; }
.chat-empty h1 { font-size: 34px; margin: 0 0 8px; }
.chat-empty .blue { color: var(--brand); }
.chat-menu { display: none; }
@media (max-width: 760px) {
  body.chat-open .top .wrap { padding: 0 16px; }
  body.chat-open .top .logo { min-width: 0; }
  .chat { grid-template-columns: minmax(0, 1fr); position: relative; }
  .chat-side { display: none; position: absolute; inset: 0; z-index: 20; }
  .chat.side-open .chat-side { display: flex; }
  .chat-menu { display: inline-block; margin: 8px 16px 0; align-self: flex-start; }
  .thread { padding: 16px; }
  .composer { padding: 8px 16px 12px; }
}
