/* AI chat (Claude-style) and custom reports */
:root {
  --c-bg: #faf9f5;
  --c-side: #f3f1ea;
  --c-line: #e6e3d9;
  --c-text: #1f1e1b;
  --c-muted: #78756c;
  --c-bubble: #efece3;
  --c-accent: #d97757;
  --c-accent-dark: #c4623f;
  --c-hover: #e9e6dc;
  --c-serif: ui-serif, Cambria, "Times New Roman", serif;
}

body.chat-mode { overflow: hidden; }
body.chat-mode main { padding: 0; max-width: none; }

.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--c-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--c-hover); color: var(--c-text); }
.btn-dark { background: var(--c-text); color: #fff; border: 0; border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.btn-dark:hover { background: #3a3833; }
.btn-ghost { background: #fff; color: var(--c-text); border: 1px solid var(--c-line); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: var(--c-hover); }
.btn-ghost.danger { color: #b3261e; }

/* ---------- Layout ---------- */
.panel.chat-panel.active { display: flex; position: fixed; inset: 56px 0 0 0; background: var(--c-bg); color: var(--c-text); }
.chat-side { width: 270px; flex-shrink: 0; background: var(--c-side); border-right: 1px solid var(--c-line); display: flex; flex-direction: column; padding: 12px 10px; gap: 8px; }
.chat-panel.side-hidden .chat-side { display: none; }
.new-chat { display: flex; align-items: center; gap: 8px; background: none; border: 0; border-radius: 10px; padding: 8px 10px; font-size: 14px; font-weight: 600; color: var(--c-text); cursor: pointer; text-align: left; }
.new-chat .new-icon { width: 26px; height: 26px; border-radius: 50%; background: var(--c-accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.new-chat:hover { background: var(--c-hover); }
.side-search { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--c-line); border-radius: 10px; padding: 6px 10px; color: var(--c-muted); }
.side-search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 13px; color: var(--c-text); }
.chat-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.side-group { font-size: 11.5px; color: var(--c-muted); padding: 12px 8px 4px; font-weight: 600; }
.side-empty { color: var(--c-muted); font-size: 13px; padding: 16px 8px; }
.chat-item { display: flex; align-items: center; border-radius: 8px; padding: 0 4px 0 10px; cursor: pointer; min-height: 34px; }
.chat-item:hover, .chat-item.active { background: var(--c-hover); }
.chat-item.active { font-weight: 600; }
.chat-item-title { flex: 1; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.other .chat-item-title, .search-hit.other .search-title { color: #b0ada6; font-weight: 500; }
.chat-item.other.active .chat-item-title { color: #8f8c84; }
.chat-owner { flex: none; margin-left: 6px; font-size: 11px; color: #b0ada6; }
.chat-item-menu { opacity: 0; padding: 4px; }
.chat-badge { display: inline-flex; color: var(--c-muted, #8a8f98); margin-left: 4px; flex: none; }
.chat-badge.in { color: #2f75b5; }
.chat-badge.inline { vertical-align: -3px; margin: 0 2px; }
.chat-share-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid #d9dce3; background: #fff; border-radius: 8px;
  padding: 5px 11px; font-size: 13px; cursor: pointer; color: inherit; }
.chat-share-btn:hover { background: var(--c-hover); }
.chat-share-btn[hidden] { display: none; }
.chat-main.empty .chat-share-btn { display: none; }
.shared-banner { display: flex; gap: 8px; align-items: flex-start; background: #eef4fb; border: 1px solid #cfe0f3; color: #24496e; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 18px; }
.shared-banner svg { flex: none; margin-top: 1px; }
.share-note { font-size: 13.5px; line-height: 1.5; margin: 0 0 12px; max-width: 520px; }
.share-row { display: flex; gap: 8px; }
.share-url { flex: 1; min-width: 360px; font: 12.5px Consolas, monospace; padding: 8px 10px; border: 1px solid #d9dce3; border-radius: 8px; background: #f7f8fa; }
.share-copy { background: #1d2433; color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.share-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 12px; color: #6b7489; }
.share-stop { background: none; border: 1px solid #e3c4c4; color: #b3261e; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 12.5px; }
.chat-item:hover .chat-item-menu, .chat-item.active .chat-item-menu { opacity: 1; }
.rename-input { flex: 1; font-size: 13.5px; border: 1px solid var(--c-accent); border-radius: 6px; padding: 4px 6px; margin: 3px 0; outline: 0; }
.search-hit { border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.search-hit:hover { background: var(--c-hover); }
.search-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-snippet { font-size: 12.5px; color: var(--c-muted); margin-top: 2px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.search-when { font-size: 11px; color: var(--c-muted); margin-top: 3px; }
mark { background: #fbe0a8; color: inherit; border-radius: 2px; }
.side-foot { display: flex; align-items: center; gap: 8px; background: none; border: 0; border-top: 1px solid var(--c-line); padding: 10px 8px 4px; font-size: 13px; color: var(--c-text); cursor: pointer; text-align: left; }
.side-foot:hover { color: var(--c-accent-dark); }

.pop-menu { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--c-line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; min-width: 150px; }
.pop-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.pop-menu button:hover { background: var(--c-hover); }
.pop-menu .danger { color: #b3261e; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 48px; }
.chat-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 0 24px; }
.chat-thread { max-width: 780px; margin: 0 auto; padding: 8px 0 24px; }
.chat-hero { display: none; }

/* Empty state: greeting with the composer in the middle */
.chat-main.empty .chat-scroll { flex: 0 0 auto; margin-top: max(10vh, 40px); overflow: visible; }
.chat-main.empty .chat-hero { display: flex; align-items: center; justify-content: center; gap: 12px; }
.chat-main.empty .chat-hero h1 { font-family: var(--c-serif); font-weight: 400; font-size: 38px; margin: 0 0 28px; color: #3d3a33; }
.chat-main.empty .chat-hero .hero-mark { margin-bottom: 26px; }
.chat-main.empty .chat-head .chat-title { display: none; }
.chat-suggestions { display: none; }
.chat-main.empty .chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 780px; margin: 14px auto 0; }
.chat-suggestions button { background: #fff; border: 1px solid var(--c-line); border-radius: 10px; padding: 7px 12px; font-size: 13px; color: #4a473f; cursor: pointer; }
.chat-suggestions button:hover { background: var(--c-hover); }
.chat-suggestions .starter-role { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-accent-dark); margin-bottom: 2px; text-align: left; }
.chat-suggestions button { text-align: left; }

.followups { display: none; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.msg.assistant.last .followups { display: flex; }
.chat-main.busy .followups { display: none; }
.followup { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--c-line); border-radius: 10px; padding: 6px 12px; font-size: 13px; color: #4a473f; cursor: pointer; text-align: left; }
.followup:hover { background: var(--c-hover); color: var(--c-text); }
.followup svg { flex: none; color: var(--c-accent); }
.chat-main.empty .chat-disclaimer { display: none; }

/* ---------- Messages ---------- */
.msg { margin: 18px 0; position: relative; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble { background: var(--c-bubble); border-radius: 16px; padding: 10px 16px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; line-height: 1.5; }
.msg.user.pending .bubble { opacity: .85; }
.msg.flash .bubble, .msg.flash .parts { animation: flash 2s ease; }
@keyframes flash { 0%, 40% { background: #fbe0a8; } 100% { } }
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 6px; max-width: 85%; }
.msg-image { max-width: 240px; max-height: 180px; border-radius: 10px; border: 1px solid var(--c-line); cursor: zoom-in; object-fit: cover; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--c-line); border-radius: 10px; padding: 8px 12px; text-decoration: none; color: var(--c-text); font-size: 13px; max-width: 280px; }
.file-chip span { display: flex; flex-direction: column; min-width: 0; }
.file-chip b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip small { color: var(--c-muted); }
.report-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #8a4a2f; cursor: pointer; }
.file-chip.report-chip { background: #fbefe9; border-color: #f0d2c4; }

.msg-actions { display: flex; align-items: center; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg.assistant.last .msg-actions { opacity: 1; }
.msg.assistant .msg-actions [data-act="retry"] { display: none; }
.msg.assistant.last .msg-actions [data-act="retry"] { display: inline-flex; }
.chat-main.busy .msg-actions [data-act="retry"], .chat-main.busy .msg-actions [data-act="edit"], .msg.streaming .msg-actions { visibility: hidden; }
.usage { font-size: 11.5px; color: var(--c-muted); margin-left: 8px; opacity: 0; }
.msg:hover .usage { opacity: 1; }

.msg.assistant .parts { font-family: var(--c-serif); font-size: 16px; line-height: 1.6; color: var(--c-text); }
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body p { margin: 0 0 12px; }
.md-body ul, .md-body ol { margin: 0 0 12px; padding-left: 24px; }
.md-body li { margin: 3px 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { font-family: var(--c-serif); line-height: 1.3; margin: 18px 0 8px; color: var(--c-text); }
.md-body h1 { font-size: 22px; } .md-body h2 { font-size: 19px; } .md-body h3 { font-size: 17px; } .md-body h4 { font-size: 16px; }
.md-body code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; background: #f0eee6; border: 1px solid #e6e3d9; border-radius: 4px; padding: 1px 4px; }
.md-body pre { background: #f7f6f1; border: 1px solid var(--c-line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 13px; }
.md-body pre code { background: none; border: 0; padding: 0; }
.md-body table { border-collapse: collapse; margin: 6px 0 14px; font-family: "Segoe UI", Arial, sans-serif; font-size: 13.5px; font-variant-numeric: tabular-nums lining-nums; display: block; overflow-x: auto; max-width: 100%; }
.md-body th { background: #f0eee6; color: var(--c-text); position: static; font-weight: 600; text-align: left; }
.md-body th, .md-body td { border: 1px solid var(--c-line); padding: 6px 10px; white-space: nowrap; }
.md-body td { text-align: left; }
.md-body td[align="right"], .md-body th[align="right"] { text-align: right; }
.md-body tr:hover td { background: transparent; }
.md-body blockquote { border-left: 3px solid var(--c-line); margin: 0 0 12px; padding: 2px 12px; color: #55524a; }
.md-body a { color: #2f6db5; }
.md-body hr { border: 0; border-top: 1px solid var(--c-line); margin: 16px 0; }

.typing { display: flex; gap: 5px; padding: 8px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--c-accent); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.thinking { margin: 4px 0 10px; font-family: "Segoe UI", Arial, sans-serif; }
.thinking summary { cursor: pointer; color: var(--c-muted); font-size: 13.5px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.thinking summary::before { content: "›"; font-size: 16px; transition: transform .15s; }
.thinking[open] summary::before { transform: rotate(90deg); }
.thinking-body { margin-top: 6px; padding: 8px 12px; border-left: 2px solid var(--c-line); color: var(--c-muted); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; max-height: 320px; overflow-y: auto; }
.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* Tool calls */
.tool { font-family: "Segoe UI", Arial, sans-serif; border: 1px solid var(--c-line); background: #fff; border-radius: 10px; margin: 8px 0 12px; overflow: hidden; }
.tool-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13.5px; color: #4a473f; }
.tool-head.expandable { cursor: pointer; }
.tool-head.expandable:hover { background: #faf9f5; }
.tool-icon { color: var(--c-accent-dark); display: inline-flex; }
.tool-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-meta { color: var(--c-muted); font-size: 12.5px; white-space: nowrap; }
.tool .chev { display: inline-flex; color: var(--c-muted); transition: transform .15s; }
.tool-head.open .chev { transform: rotate(90deg); }
.tool-err { color: #b3261e; font-size: 12.5px; }
.tool.error { border-color: #f0c9c4; }
.tool-btn { background: #fff; border: 1px solid var(--c-line); border-radius: 7px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--c-text); }
.tool-btn:hover { background: var(--c-hover); }
.tool-body { border-top: 1px solid var(--c-line); padding: 10px 12px; }
.tool-error { color: #b3261e; font-size: 13px; margin-bottom: 8px; white-space: pre-wrap; }
.tool-chart { height: 260px; padding: 8px 12px 12px; border-top: 1px solid var(--c-line); }
.tool-table { max-height: 360px; overflow: auto; border: 1px solid var(--c-line); border-radius: 6px; }
.tool-note { color: var(--c-muted); font-size: 12px; margin-top: 6px; }
.tool-actions { display: flex; gap: 6px; margin-top: 8px; }
pre.sql { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; background: #f7f6f1; border: 1px solid var(--c-line); border-radius: 6px; padding: 10px; margin: 0 0 10px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.kb-diff { font-size: 14px; }
.kb-old { text-decoration: line-through; color: var(--c-muted); white-space: pre-wrap; margin-bottom: 6px; }
.msg-status { font-family: "Segoe UI", Arial, sans-serif; font-size: 13px; color: var(--c-muted); margin-top: 6px; }
.msg-status.error { color: #b3261e; }

.result-table { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; width: 100%; }
.result-table th { background: #f3f1ea; color: var(--c-text); font-weight: 600; text-align: left; position: sticky; top: 0; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
.result-table th, .result-table td { padding: 5px 10px; border-bottom: 1px solid #efede6; white-space: nowrap; }
.result-table td { text-align: left; }
.result-table .num { text-align: right; }
.result-table td.neg { color: #b3261e; }
.result-table tr:hover td { background: #faf9f5; }

.spinner { width: 14px; height: 14px; border: 2px solid #e6d3c9; border-top-color: var(--c-accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: middle; }
.spinner.small { width: 12px; height: 12px; }
.retry-note { font-size: 12.5px; color: var(--c-muted); margin-top: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Composer ---------- */
.chat-main.view-only .msg-actions [data-act="edit"],
.chat-main.view-only .msg-actions [data-act="retry"],
.chat-main.view-only .followups { display: none; }
.chat-main.view-only .composer { opacity: 0.55; }
.composer-wrap { padding: 0 24px 10px; }
.composer { max-width: 780px; margin: 0 auto; background: #fff; border: 1px solid var(--c-line); border-radius: 20px; box-shadow: 0 4px 20px rgba(0,0,0,.045); padding: 12px 12px 8px 16px; }
.composer:focus-within { border-color: #d6d2c4; box-shadow: 0 4px 24px rgba(0,0,0,.07); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; font: inherit; font-size: 15px; line-height: 1.5; background: transparent; color: var(--c-text); max-height: 40vh; padding: 2px 0; }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.composer-bar .attach { border: 1px solid var(--c-line); border-radius: 9px; padding: 5px; }
.model-name { margin-left: auto; font-size: 12.5px; color: var(--c-muted); }
.send-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--c-accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.send-btn:hover { background: var(--c-accent-dark); }
.send-btn:disabled { background: #e8b9a6; cursor: default; }
.send-btn.stop { background: var(--c-text); }
.chat-disclaimer { text-align: center; font-size: 11.5px; color: var(--c-muted); margin-top: 6px; }

.composer-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pending-file { position: relative; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--c-line); background: #faf9f5; border-radius: 10px; padding: 8px 28px 8px 10px; font-size: 12.5px; max-width: 240px; }
.pending-file span { display: flex; flex-direction: column; min-width: 0; }
.pending-file b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending-file small { color: var(--c-muted); }
.pending-file.image { padding: 0; width: 64px; height: 64px; overflow: hidden; }
.pending-file.image img { width: 100%; height: 100%; object-fit: cover; }
.pending-file.image .spinner { position: absolute; left: 24px; top: 24px; }
.pending-file.uploading { opacity: .7; }
.pending-file.error { border-color: #f0c9c4; }
.pending-file.report { background: #fbefe9; border-color: #f0d2c4; }
.pending-remove { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(31,30,27,.7); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }

.drop-overlay { display: none; position: absolute; inset: 8px; border: 2px dashed var(--c-accent); border-radius: 16px; background: rgba(250,249,245,.92); align-items: center; justify-content: center; font-size: 18px; color: var(--c-accent-dark); z-index: 10; pointer-events: none; }
.chat-main.dragging .drop-overlay { display: flex; }

.edit-box { width: 85%; background: #fff; border: 1px solid var(--c-line); border-radius: 14px; padding: 10px; }
.edit-box textarea { width: 100%; border: 0; outline: 0; resize: vertical; font: inherit; font-size: 15px; min-height: 60px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- Modal, toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20,20,19,.4); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); min-width: 320px; min-height: 180px; max-width: calc(100vw - 48px); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); resize: both; overflow: hidden; }
.modal.wide { width: min(720px, 100%); height: min(480px, 88vh); min-height: 260px; }
.modal-back.modal-stack-hidden { visibility: hidden; pointer-events: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--c-line); flex-shrink: 0; }
.modal-head-start { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; }
.modal-head-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.modal-back-btn { flex-shrink: 0; transform: rotate(180deg); }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--c-text); line-height: 1.35; word-break: break-word; }
.modal-embed { display: block; width: 100%; height: min(70vh, 720px); border: 0; border-radius: 8px; background: #f7f9fc; }
.attach-pick-list { list-style: none; margin: 0; padding: 0; }
.attach-pick-list li { border-bottom: 1px solid var(--c-line); }
.attach-pick { display: block; width: 100%; text-align: left; padding: 10px 4px; border: 0; background: none; font: inherit; color: var(--c-text); cursor: pointer; word-break: break-word; }
.attach-pick:hover { color: var(--c-accent, #2f75b5); text-decoration: underline; }
.modal-body { padding: 16px 18px; overflow: auto; flex: 1; min-height: 0; }
.modal-body .result-table { width: 100%; table-layout: fixed; }
.modal-body .result-table th, .modal-body .result-table td { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.modal-body .result-table th.num, .modal-body .result-table td.num { white-space: nowrap; width: 7.5em; }
.modal-body .result-table .col-date { width: 6.5em; }
.modal-body .result-table .col-doc { width: 5em; }
.modal-body .result-table .col-type { width: 7em; }
.modal-body .result-table .col-action { width: 2.5em; white-space: nowrap; text-align: center; }
.modal-body .result-table .drill-txn-row { cursor: pointer; }
.modal-body .result-table .drill-txn-row:hover td { background: #eaf2fb; }
.modal-body .result-table .txn-line-attach { color: var(--c-muted); }
.modal-body .result-table .txn-line-attach:hover { color: var(--c-accent, #2f75b5); }
.modal-image { max-width: 100%; display: block; margin: 0 auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--c-text); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 70; transition: opacity .3s; }
.toast.bad { background: #b3261e; }
.toast.out { opacity: 0; }

.kb-layout { display: grid; grid-template-columns: 1fr 260px; gap: 20px; }
.kb-content { font-family: var(--c-serif); font-size: 15px; line-height: 1.55; }
.kb-revisions { border-left: 1px solid var(--c-line); padding-left: 16px; font-size: 13px; }
.kb-revisions h4 { margin: 0 0 10px; }
.kb-rev { margin-bottom: 10px; }
.kb-rev small { color: var(--c-muted); }
.kb-tip { color: var(--c-muted); font-size: 12.5px; margin-top: 16px; }
details.version { border-bottom: 1px solid var(--c-line); padding: 8px 0; }
details.version summary { cursor: pointer; font-size: 13.5px; }
details.version summary small { color: var(--c-muted); margin-left: 6px; }
details.version pre { margin-top: 8px; }

@media (max-width: 800px) {
  .chat-side { position: absolute; z-index: 20; height: 100%; box-shadow: 4px 0 20px rgba(0,0,0,.1); }
  .chat-scroll, .composer-wrap { padding-left: 12px; padding-right: 12px; }
}
