:root {
  --bg: #f7f8f9;
  --panel: #ffffff;
  --sidebar: #f1f3f4;
  --ink: #1e2429;
  --muted: #6a747c;
  --line: #dfe4e7;
  --accent: #292a68;
  --accent-soft: #e9e9f5;
  --focus: #4969a8;
  --user: #e8f0fb;
  --danger: #b84843;
  --markdown-inline-code-bg: #f0f2f4;
  --markdown-table-separator: #dfe4e7;
  --markdown-table-header-separator: #c8d0d6;
  --markdown-code-bg: #1b1f23;
  --markdown-code-border: #353b42;
  --markdown-code-text: #e2e6eb;
  --markdown-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #171a1c;
  --panel: #1d2022;
  --sidebar: #151819;
  --ink: #edf0f2;
  --muted: #9ca7ad;
  --line: #343a3e;
  --accent: #6f8de8;
  --accent-soft: #293552;
  --focus: #7fa0ff;
  --user: #29384d;
  --danger: #e27370;
  --markdown-inline-code-bg: #2a3035;
  --markdown-table-separator: #343a3e;
  --markdown-table-header-separator: #485158;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Arial, sans-serif; font-size: var(--ui-font-body); letter-spacing: 0; }
button, input, textarea { font: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100vh; transition: grid-template-columns .18s ease; }
.app-shell.sidebar-collapsed { grid-template-columns: 48px minmax(0, 1fr); }
.sidebar { position: relative; z-index: 2; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 252px; min-width: 0; min-height: 0; padding: 14px 12px; overflow: hidden; background: var(--sidebar); border-right: 1px solid var(--line); transition: transform .18s ease, visibility .18s ease; }
.sidebar-header { --sidebar-icon-column: 36px; --sidebar-label-gap: var(--ui-sidebar-label-gap); --sidebar-row-padding: 7px; display: grid; gap: 8px; min-width: 0; }
.brand-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0; }
.brand-mark { display: block; object-fit: contain; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 36px; }
.brand-home { display: grid; grid-template-columns: var(--sidebar-icon-column) minmax(0, 1fr); min-width: 0; align-items: center; gap: var(--sidebar-label-gap); min-height: 42px; padding: 3px var(--sidebar-row-padding); border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; }
.brand-home:hover { background: #e3e6e8; }
.brand-home strong { font-size: var(--ui-font-brand); font-weight: 700; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #4d5860; cursor: pointer; }
.icon-btn:hover { background: #e1e5e7; }
.sidebar-close { display: grid; margin-left: auto; }
.sidebar-icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; background: currentColor; mask: var(--sidebar-icon) center / contain no-repeat; }
.icon-pencil { --sidebar-icon: url("assets/lucide-pencil-line.svg"); }
.icon-book { --sidebar-icon: url("assets/lucide-book-open.svg"); }
.icon-search { --sidebar-icon: url("assets/lucide-search.svg"); }
.icon-panel-open { --sidebar-icon: url("assets/lucide-panel-left-open.svg"); }
.icon-panel-close { --sidebar-icon: url("assets/lucide-panel-left-close.svg"); }
.icon-account { --sidebar-icon: url("assets/lucide-user-round.svg"); }
.rail-toggle { display: none; position: relative; width: 36px; height: 36px; border: 0; border-radius: 50%; padding: 6px; background: transparent; color: var(--ink); cursor: pointer; }
.rail-logo { display: block; width: 24px; height: 24px; object-fit: contain; }
.rail-toggle .sidebar-icon { display: none; }
.rail-toggle:hover, .rail-toggle:focus-visible { background: var(--line); }
.rail-toggle:hover .rail-logo, .rail-toggle:focus-visible .rail-logo { display: none; }
.rail-toggle:hover .sidebar-icon, .rail-toggle:focus-visible .sidebar-icon { display: block; }
.rail-toggle::after { content: "Open sidebar"; position: absolute; left: 44px; top: 3px; padding: 7px 10px; border-radius: 8px; background: #202326; color: #fff; white-space: nowrap; font-size: var(--ui-font-small); pointer-events: none; opacity: 0; }
.rail-toggle:hover::after, .rail-toggle:focus-visible::after { opacity: 1; }
.sidebar-action { display: grid; grid-template-columns: var(--sidebar-icon-column) minmax(0, 1fr); align-items: center; gap: var(--sidebar-label-gap); width: 100%; min-height: 34px; padding: 0 var(--sidebar-row-padding); border: 0; border-radius: 18px; background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; font-size: var(--ui-font-sidebar); text-align: left; }
.sidebar-action > .sidebar-icon { justify-self: center; }
.sidebar-action:hover { background: var(--line); }
.manual-action[aria-disabled="true"] { color: var(--muted); opacity: .65; cursor: default; }
.manual-action[aria-disabled="true"]:hover { background: transparent; }
.new-chat { background: transparent; font-weight: 600; }
.new-chat.active { background: #e6e8ea; }
.new-chat:hover { background: #e1e5e7; }
.chat-search { display: grid; grid-template-columns: var(--sidebar-icon-column) minmax(0, 1fr) 24px; align-items: center; gap: var(--sidebar-label-gap); min-height: 34px; margin-bottom: 10px; padding: 0 var(--sidebar-row-padding); border-radius: 18px; background: transparent; color: var(--ink); }
.chat-search:focus-within { background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.search-shortcut { display: grid; place-items: center; width: var(--sidebar-icon-column); height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.chat-search input { width: 100%; min-width: 0; height: 34px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: var(--ui-font-sidebar); }
.chat-search input::-webkit-search-cancel-button { display: none; }
.chat-search input::placeholder { color: var(--ink); opacity: 1; }
.search-clear { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #667279; cursor: pointer; font-size: var(--ui-font-symbol); line-height: 1; }
.search-clear:hover { background: #d4dadd; color: var(--ink); }
.history-section { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; overflow: hidden; }
.history-section.no-results { grid-template-rows: auto auto; align-content: start; }
.history-head { display: flex; align-items: center; min-height: 24px; padding: 0 10px 8px; color: var(--muted); font-size: var(--ui-font-history); }
.history { display: flex; flex: 1 1 auto; flex-direction: column; gap: 4px; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-color: #bec6cb transparent; scrollbar-width: thin; }
.history::-webkit-scrollbar { width: 7px; }
.history::-webkit-scrollbar-track { background: transparent; }
.history::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: #bec6cb; background-clip: padding-box; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; min-height: 40px; border-radius: 20px; }
.history-row:hover, .history-row.active { background: #dfe5e8; }
.history-item { min-width: 0; height: 40px; padding: 0 12px; overflow: hidden; border: 0; border-radius: 20px 0 0 20px; background: transparent; color: #3e4951; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: var(--ui-font-history); }
.delete-chat { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #7a858c; cursor: pointer; opacity: 0; line-height: 0; }
.delete-icon { display: block; width: 14px; height: 14px; }
.history-row:hover .delete-chat, .history-row:focus-within .delete-chat, .history-row.active .delete-chat { opacity: 1; }
.delete-chat:hover { background: #f8dddd; color: var(--danger); }
.history-empty { padding: 12px 10px; color: var(--muted); font-size: var(--ui-font-caption); }
.sidebar-footer { display: grid; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.account-area { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 38px; padding: 4px 4px 4px 12px; border-radius: 19px; }
.account-area:hover { background: #e6eaec; }
.account-name { min-width: 0; overflow: hidden; color: #3d484f; text-overflow: ellipsis; white-space: nowrap; font-size: var(--ui-font-account); font-weight: 600; }
.sign-out-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 0 11px; border: 1px solid #d4dade; border-radius: 15px; background: #fff; color: var(--muted); cursor: pointer; font-size: var(--ui-font-tiny); }
.sign-out-btn .sidebar-icon { display: none; }
.sign-out-btn:hover { border-color: #bbc5ca; color: var(--ink); }
.resource-links { display: flex; align-items: center; gap: 7px; min-height: 24px; padding: 0 12px; color: var(--muted); font-size: var(--ui-font-caption); }
.resource-links:not(:has(> a:not([hidden]))) { display: none; }
.resource-links a { color: #536069; text-decoration: none; }
.resource-links a:hover { color: var(--ink); text-decoration: underline; }

.workspace { display: grid; grid-template-rows: 58px minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; background: var(--panel); }
.topbar { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 0 22px; background: rgba(255, 255, 255, .97); }
.menu-btn { display: none; }
.page-title { margin-right: auto; font-size: var(--ui-font-page-title); font-weight: 650; }
.topbar-btn { width: 34px; height: 34px; color: var(--muted); }
.topbar-btn:hover:not(:disabled) { background: #edf0f2; color: var(--ink); }
.topbar-btn:disabled { cursor: default; opacity: .38; }
.topbar-btn svg { width: 18px; height: 18px; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
.backend-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: var(--ui-font-small); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #97a1a8; }
.backend-state.online .status-dot { background: #339b68; }
.backend-state.pending .status-dot { background: #d58a22; }
.backend-state.error .status-dot { background: var(--danger); }
.backend-state.offline .status-dot { background: var(--danger); }
.view-stack, .page-view { min-width: 0; min-height: 0; height: 100%; }
.view-stack { position: relative; overflow: hidden; }
.chat-view { position: relative; overflow: hidden; --composer-clearance: 140px; }
.conversation-shell { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; }
.conversation { position: relative; min-width: 0; min-height: 0; overflow-y: auto; scroll-behavior: auto; scroll-padding-bottom: calc(var(--composer-clearance) + 16px); scrollbar-width: none; }
.conversation::-webkit-scrollbar { display: none; width: 0; height: 0; }
.chat-scrollbar { position: absolute; inset: 6px 5px calc(var(--composer-clearance) + 6px) auto; z-index: 4; display: grid; grid-template-rows: 24px minmax(0, 1fr) 24px; justify-items: center; width: 24px; min-height: 0; border: 1px solid #d9dfe2; border-radius: 8px; background: rgba(247, 248, 249, .96); box-shadow: 0 1px 4px rgba(24, 38, 49, .08); }
.chat-scrollbar[hidden] { display: none; }
.scroll-step { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #66747c; cursor: pointer; }
.scroll-step:hover:not(:disabled) { background: #e1e6e8; color: var(--ink); }
.scroll-step:disabled { cursor: default; opacity: .32; }
.scroll-step svg { width: 15px; height: 15px; }
.scroll-track { position: relative; width: 12px; height: 100%; min-height: 36px; border-radius: 6px; outline: 0; background: #e5e9eb; cursor: pointer; touch-action: none; }
.scroll-track:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.scroll-thumb { position: absolute; top: 0; left: 1px; width: 10px; min-height: 34px; border: 2px solid #e5e9eb; border-radius: 6px; background: #87949b; cursor: grab; touch-action: none; }
.scroll-thumb:hover { background: #68767e; }
.scroll-thumb.dragging { cursor: grabbing; background: #536168; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-width: 0; height: 100%; min-height: 340px; padding: 32px; text-align: center; }
.chat-view.empty-chat { display: grid; grid-template-rows: minmax(min-content, 1fr) auto minmax(24px, 1fr); overflow-y: auto; }
.chat-view.empty-chat .conversation-shell { position: relative; inset: auto; grid-row: 1; align-self: end; margin: 0; overflow: visible; }
.chat-view.empty-chat .conversation { overflow: visible; }
.chat-view.empty-chat .empty-state { height: auto; min-height: 0; padding: 24px 32px 36px; }
/* Equal space above/below the input row centers the form, not the greeting group. */
.chat-view.empty-chat .composer-area { position: relative; inset: auto; grid-row: 2; margin: 0; padding-block: 0; }
.empty-state h1 { margin: 0; font-size: var(--ui-font-welcome); font-weight: 600; }
.messages { width: min(880px, calc(100% - 56px)); margin: 0 auto; padding: 28px 0 calc(var(--composer-clearance) + 16px); }
.message { margin: 0 0 24px; }
.message-body { min-width: 0; color: #263139; font-size: var(--ui-font-message); line-height: 1.65; overflow-wrap: anywhere; }
.message.user { display: flex; flex-direction: column; align-items: flex-end; }
.message.user .message-body { max-width: 78%; padding: 10px 15px; border-radius: 20px 20px 6px 20px; background: var(--user); line-height: 1.5; }
.message-actions { display: flex; align-items: center; min-height: 36px; margin-top: 3px; }
.message.user .message-actions { margin-right: 4px; }
.answer-copy { position: relative; display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; transition: opacity .12s ease, background .12s ease, color .12s ease; }
.answer-copy:hover { background: #e8ecee; color: var(--ink); }
.answer-copy svg { width: 20px; height: 20px; flex-shrink: 0; }
.answer-copy.copied { color: #2b9362; }
@media (hover: hover) and (pointer: fine) {
  .message .answer-copy { opacity: 0; pointer-events: none; }
  .message:hover .answer-copy, .message .answer-copy:focus-visible { opacity: 1; pointer-events: auto; }
}
.answer-copy::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%; z-index: 20; padding: 5px 7px; border-radius: 5px; background: #202326; color: #fff; font-size: var(--ui-font-caption); line-height: 1; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 3px); transition: opacity .12s ease, transform .12s ease, visibility .12s; }
.answer-copy:hover::after, .answer-copy:focus-visible::after { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.message-body p { margin: 0 0 10px; white-space: pre-wrap; }
.message-body p:last-child { margin-bottom: 0; }
.markdown-body { --md-space: 14px; --md-block-space: 20px; --md-heading-space: 28px; font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.7; }
.markdown-body p { white-space: normal; margin: 0 0 var(--md-space); }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 { margin: var(--md-heading-space) 0 calc(var(--md-space) * .65); color: inherit; font-weight: 650; line-height: 1.35; }
.markdown-body h1 { font-size: var(--ui-font-markdown-h1); }
.markdown-body h2 { font-size: var(--ui-font-markdown-h2); }
.markdown-body h3 { font-size: var(--ui-font-markdown-h3); }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { font-size: var(--ui-font-markdown-heading); }
.markdown-body strong { font-weight: 650; }
.markdown-body ul, .markdown-body ol { margin: var(--md-space) 0; padding-left: 1.5em; }
.markdown-body li { padding-left: .2em; margin: calc(var(--md-space) * .25) 0; }
.markdown-body li::marker { color: var(--muted); }
.markdown-body li > ul, .markdown-body li > ol { margin: calc(var(--md-space) * .25) 0; }
.markdown-body li > p { margin: calc(var(--md-space) * .4) 0; }
.markdown-body blockquote { margin: var(--md-block-space) 0; padding: 0 16px; border-left: 2px solid var(--line); color: var(--muted); }
.markdown-body blockquote > :first-child { margin-top: 0; }
.markdown-body blockquote > :last-child { margin-bottom: 0; }
.markdown-body :not(pre) > code { padding: .12em .35em; border-radius: 5px; background: var(--markdown-inline-code-bg); color: inherit; font-family: var(--markdown-mono); font-size: var(--ui-font-inline-code); overflow-wrap: anywhere; }
.markdown-body a { color: #315ea8; text-decoration: underline; text-underline-offset: 3px; }
html[data-theme="dark"] .markdown-body a { color: #a5c5ff; }
.markdown-body hr { margin: var(--md-heading-space) 0; border: 0; border-top: 1px solid var(--line); }
.markdown-table { position: relative; max-width: 100%; margin: var(--md-block-space) 0; }
.markdown-table-scroll { max-width: 100%; margin: var(--md-block-space) 0; overflow-x: auto; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.markdown-table > .markdown-table-scroll { margin: 0; }
.table-copy { position: absolute; top: 5px; right: 8px; z-index: 1; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: var(--panel); color: var(--muted); cursor: pointer; }
.table-copy:hover { color: var(--ink); background: var(--sidebar); }
.table-copy.copied { color: #2b9362; }
html[data-theme="dark"] .table-copy.copied { color: #6fd0a1; }
.table-copy .copy-symbol { width: 20px; height: 20px; }
.table-copy .copy-symbol::before, .table-copy .copy-symbol::after { width: 11px; height: 12px; border-width: 1.5px; }
.table-copy .copy-symbol::before { left: 2px; top: 2px; }
.table-copy .copy-symbol::after { left: 6px; top: 6px; background: var(--panel); }
.table-copy:hover .copy-symbol::after { background: var(--sidebar); }
@media (hover: hover) and (pointer: fine) {
  .markdown-table .table-copy { opacity: 0; pointer-events: none; }
  .markdown-table:hover .table-copy, .markdown-table .table-copy:focus-visible { opacity: 1; pointer-events: auto; }
}
.markdown-table-scroll:focus-visible, .markdown-math-block:focus-visible, .code-block pre:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.markdown-table-scroll table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: var(--ui-font-table); line-height: 1.5; }
.markdown-table-scroll th, .markdown-table-scroll td { padding: 10px 14px; border-bottom: 1px solid var(--markdown-table-separator); text-align: left; vertical-align: top; overflow-wrap: normal; }
.markdown-table-scroll th { border-bottom-color: var(--markdown-table-header-separator); background: transparent; color: inherit; font-weight: 600; }
.markdown-table-scroll th:first-child, .markdown-table-scroll td:first-child { padding-left: 8px; }
.markdown-table-scroll th:last-child, .markdown-table-scroll td:last-child { padding-right: 8px; }
.markdown-table-scroll th.table-copy-cell { position: relative; height: 42px; padding-right: 48px; }
.markdown-table-scroll tbody tr:last-child td { border-bottom: 0; }
.code-block { max-width: 100%; margin: var(--md-block-space, 20px) 0; overflow: hidden; border: 1px solid var(--markdown-code-border); border-radius: 12px; background: var(--markdown-code-bg); color-scheme: dark; }
.code-head { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--markdown-code-border); background: #23282e; color: #b9c1ca; font: var(--ui-font-code-header) var(--markdown-mono); }
.code-head > span { min-width: 0; overflow-wrap: anywhere; }
.copy-code { display: flex; align-items: center; flex-shrink: 0; gap: 6px; min-height: 30px; margin-left: auto; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #cbd2d9; cursor: pointer; font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: var(--ui-font-small); }
.copy-code:hover { background: #293138; color: #fff; }
.copy-code.copied { color: #6fd0a1; }
.copy-symbol { position: relative; width: 12px; height: 12px; }
.copy-symbol::before, .copy-symbol::after { content: ""; position: absolute; width: 7px; height: 8px; border: 1px solid currentColor; border-radius: 2px; }
.copy-symbol::before { left: 1px; top: 1px; }
.copy-symbol::after { left: 4px; top: 4px; background: #23282e; }
.message-body pre { max-width: 100%; margin: 0; padding: 16px 18px; overflow: auto; background: var(--markdown-code-bg); color: var(--markdown-code-text); font: var(--ui-font-code)/1.65 var(--markdown-mono); tab-size: 4; white-space: pre; overflow-wrap: normal; }
.message-body pre code { font: inherit; }
/* Muted token palette: every text color exceeds 4.5:1 on the code surface. */
.code-block .token.comment, .code-block .token.prolog, .code-block .token.doctype, .code-block .token.cdata { color: #9da8b3; }
.code-block .token.punctuation, .code-block .token.operator, .code-block .token.entity { color: #c2cbd4; }
.code-block .token.property, .code-block .token.tag, .code-block .token.boolean, .code-block .token.number, .code-block .token.constant, .code-block .token.symbol { color: #b7cbea; }
.code-block .token.selector, .code-block .token.attr-name, .code-block .token.string, .code-block .token.char, .code-block .token.builtin, .code-block .token.url { color: #b4ceb9; }
.code-block .token.atrule, .code-block .token.keyword { color: #c6b8df; }
.code-block .token.function, .code-block .token.class-name, .code-block .token.regex, .code-block .token.important, .code-block .token.variable { color: #dbc5a5; }
.code-block .token.bold, .code-block .token.important { font-weight: 600; }
.code-block .token.italic { font-style: italic; }
.markdown-math-inline { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding: .12em 0; }
.markdown-math-inline .katex { font-size: var(--ui-font-math-inline); }
.markdown-math-block { display: block; max-width: 100%; margin: var(--md-block-space) 0; padding: 4px 2px; overflow-x: auto; overflow-y: hidden; }
.markdown-math-block .katex-display { margin: 0; text-align: center; }
.markdown-math-block .katex-display > .katex { display: block; width: max-content; min-width: 100%; text-align: center; font-size: var(--ui-font-math-block); }
.markdown-math-fallback { color: inherit; font-family: var(--markdown-mono); font-size: var(--ui-font-inline-code); white-space: pre-wrap; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.message-sources { display: grid; gap: 5px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.message-sources strong { color: var(--muted); font-size: var(--ui-font-caption); text-transform: uppercase; }
.message-sources a { width: fit-content; max-width: 100%; overflow: hidden; color: #315ea8; font-size: var(--ui-font-small); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.message-sources a:hover { text-decoration: underline; }
.typing { display: flex; gap: 4px; padding: 8px 0; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: #87939a; animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.composer-area { --composer-bottom-space: 22px; --composer-radius: 24px; position: absolute; inset: auto 0 0; z-index: 6; min-width: 0; padding: 16px 24px var(--composer-bottom-space); background: transparent; pointer-events: none; }
/* Cover the lower corner cutouts as well as the space below the form. */
.chat-view:not(.empty-chat) .composer-area::after { content: ""; position: absolute; inset: auto 0 0; z-index: -1; height: calc(var(--composer-bottom-space) + var(--composer-radius)); background: var(--panel); pointer-events: auto; }
.run-status { width: fit-content; max-width: min(880px, 100%); margin: 0 auto 6px; padding: 3px 9px; border-radius: 12px; background: var(--panel); color: var(--muted); font-size: var(--ui-font-caption); pointer-events: auto; }
.run-status:empty { display: none; }
.composer-attachments { display: flex; flex-wrap: wrap; gap: 6px; max-height: min(120px, 20vh); overflow-y: auto; width: min(880px, 100%); min-width: 0; margin: 0 auto 6px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: min(100%, 320px); min-height: 28px; padding: 0 5px 0 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--muted); font-size: var(--ui-font-caption); pointer-events: auto; }
.attachment-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.attachment-remove:hover { background: #e8ecee; color: var(--ink); }
.attachment-remove svg { display: block; width: 13px; height: 13px; }
.composer-stack { width: min(880px, 100%); max-width: 100%; min-width: 0; margin: 0 auto; }
.composer { display: flex; align-items: center; width: 100%; max-width: 100%; min-width: 0; min-height: 58px; margin: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--composer-radius); background: var(--panel); box-shadow: none; pointer-events: auto; }
.composer:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(73, 105, 168, .1); }
.composer-input { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; flex: 1 1 auto; }
.composer-attach { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.composer-attach:hover:not(:disabled) { background: #e8ecee; color: var(--ink); }
.composer-attach:disabled { cursor: wait; opacity: .45; }
.composer-attach svg { display: block; width: 18px; height: 18px; }
.composer textarea { display: block; width: auto; min-width: 0; flex: 1 1 auto; max-height: 132px; min-height: 40px; padding: 8px 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: var(--ui-font-composer); line-height: 1.45; }
.composer textarea::placeholder { color: #7f8990; }
.composer-tools { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; min-height: 38px; flex: 0 0 auto; }
.reasoning-picker { position: relative; z-index: 12; min-width: 0; flex: 0 0 auto; }
.reasoning-trigger { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px; border: 0; border-radius: 17px; background: transparent; color: var(--ink); font-size: var(--ui-font-menu); cursor: pointer; }
.reasoning-trigger:hover:not(:disabled), .reasoning-picker.open .reasoning-trigger { background: var(--markdown-inline-code-bg); }
.reasoning-trigger:disabled { color: var(--muted); cursor: wait; }
.selected-model-label { max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reasoning-trigger-label { color: var(--muted); font-size: var(--ui-font-small); white-space: nowrap; }
.model-chevron { display: block; width: 14px; height: 14px; flex: 0 0 14px; transform: rotate(180deg); transition: transform .14s ease; }
.reasoning-picker.open .model-chevron { transform: rotate(0); }
.reasoning-menu { position: fixed; z-index: 40; display: grid; grid-template-columns: max-content minmax(0, 1fr); width: max-content; max-width: calc(100vw - 24px); max-height: min(300px, calc(100dvh - 24px)); padding: 10px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 8px 28px rgba(0, 0, 0, .12); scrollbar-width: thin; }
.reasoning-options { padding-right: 8px; }
.model-column { min-width: 0; padding-left: 10px; border-left: 1px solid var(--line); }
.model-menu { display: grid; align-content: start; min-width: 0; }
.model-state { padding: 7px 8px; color: var(--muted); font-size: var(--ui-font-small); }
.reasoning-option, .model-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; font-size: var(--ui-font-menu); text-align: left; }
.reasoning-option:hover:not(:disabled), .model-option:hover:not(:disabled) { background: var(--markdown-inline-code-bg); }
.reasoning-option:disabled, .model-option:disabled { color: var(--muted); cursor: not-allowed; }
.reasoning-option { display: grid; grid-template-columns: minmax(0, 1fr) 18px; column-gap: 10px; }
.reasoning-option > span:first-child { min-width: max-content; white-space: nowrap; }
.model-option { display: grid; grid-template-columns: minmax(0, 1fr) 18px; }
.model-option.model-future { grid-template-columns: minmax(0, 1fr); }
.model-option-label { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); gap: .3em; min-width: 0; white-space: nowrap; }
.model-family, .model-tier, .model-mode { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.model-variant { display: grid; grid-template-columns: 2.9em minmax(0, 1fr); gap: .3em; min-width: 0; }
.model-option-check, .option-check { width: 18px; flex: 0 0 18px; color: inherit; font-size: var(--ui-font-symbol); line-height: 1; text-align: center; }
.voice-status { margin-left: auto; color: var(--danger); font-size: var(--ui-font-tiny); }
.voice-actions { display: flex; align-items: center; gap: 2px; }
.voice-btn, .send-btn { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; }
.mic-btn { background: transparent; color: #4b555c; }
.mic-btn:hover { background: #e8ecee; }
.wave-btn { background: #202326; color: #fff; }
.wave-btn:hover { background: #363a3e; }
.voice-btn.recording { background: #f0d6d5; color: var(--danger); }
.send-btn { background: var(--accent); color: #fff; }
.send-btn:hover { background: #106d62; }
.send-btn.cancel { background: var(--danger); }
.send-btn:disabled { cursor: wait; opacity: .7; }
.send-icon, .stop-icon { display: block; width: 19px; height: 19px; }
.stop-icon { display: none; width: 17px; height: 17px; }
.send-btn.cancel .send-icon { display: none; }
.send-btn.cancel .stop-icon { display: block; }
.mic-icon { display: block; width: 20px; height: 20px; flex: 0 0 20px; overflow: visible; }
.wave-symbol { display: flex; align-items: center; justify-content: center; gap: 2px; width: 22px; height: 20px; }
.wave-symbol i { display: block; width: 2px; border-radius: 2px; background: currentColor; }
.wave-symbol i:nth-child(1), .wave-symbol i:nth-child(5) { height: 6px; }
.wave-symbol i:nth-child(2), .wave-symbol i:nth-child(4) { height: 13px; }
.wave-symbol i:nth-child(3) { height: 18px; }
.recording .wave-symbol i { animation: wave .7s ease-in-out infinite alternate; }
.recording .wave-symbol i:nth-child(2) { animation-delay: .12s; }
.recording .wave-symbol i:nth-child(3) { animation-delay: .24s; }
@keyframes wave { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.artifact-image-gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 18px 0; min-width: 0; }
.artifact-image-gallery:not([data-count="1"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.artifact-image-gallery[data-count="3"] > :last-child { grid-column: 1 / -1; }
.artifact-image-item { min-width: 0; max-width: 100%; margin: 0; }
.artifact-image-open { display: block; width: fit-content; max-width: 100%; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: zoom-in; }
.artifact-image-open:disabled { display: none; }
.artifact-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 620px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; }
.artifact-image-loading, .artifact-image-error { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: min(100%, 620px); max-height: 620px; min-height: 120px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--markdown-inline-code-bg); color: var(--muted); font-size: var(--ui-font-small); text-align: center; }
.artifact-image-error small { max-width: 100%; overflow-wrap: anywhere; }
.artifact-image-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; min-height: 32px; margin-top: 4px; opacity: 0; transition: opacity .12s ease; }
.artifact-image-item:hover .artifact-image-actions, .artifact-image-item:focus-within .artifact-image-actions, .artifact-image-item[data-state="error"] .artifact-image-actions { opacity: 1; }
.artifact-image-actions button, .artifact-image-dialog-footer button { min-height: 32px; padding: 4px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: var(--ui-font-small); cursor: pointer; }
.artifact-image-actions button:hover:not(:disabled), .artifact-image-dialog-footer button:hover { background: var(--markdown-inline-code-bg); color: var(--ink); }
.artifact-image-actions button:disabled { display: none; }
.artifact-image-dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(10, 14, 18, .78); }
.artifact-image-dialog-content { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%; max-height: 100%; min-width: 0; padding: 48px 16px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); }
.artifact-image-dialog-content > img { display: block; width: auto; height: auto; min-height: 0; max-width: 100%; max-height: calc(100dvh - 180px); object-fit: contain; }
.artifact-image-dialog-close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: var(--ui-font-symbol); cursor: pointer; }
.artifact-image-dialog-close:hover { background: var(--markdown-inline-code-bg); }
.artifact-image-dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-width: 0; font-size: var(--ui-font-small); }
.artifact-image-dialog-footer span { min-width: 0; overflow-wrap: anywhere; }
.artifact-image-dialog-footer button { flex-shrink: 0; color: var(--ink); }
@media (hover: none), (max-width: 760px) {
  .artifact-image-actions { opacity: 1; }
}
@media (max-width: 760px) {
  .artifact-image-gallery:not([data-count="1"]) { grid-template-columns: minmax(0, 1fr); }
  .artifact-image-gallery[data-count="3"] > :last-child { grid-column: auto; }
  .artifact-image-dialog { padding: 10px; }
  .artifact-image-dialog-content { padding: 44px 10px 8px; border-radius: 12px; }
  .artifact-image-dialog-content > img { max-height: calc(100dvh - 132px); }
}


.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: 360px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 8px 24px rgba(24, 38, 49, .14); font-size: var(--ui-font-small); }
.mobile-backdrop { position: fixed; inset: 0; z-index: 8; background: rgba(20, 30, 38, .28); }
.auth-gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(20, 30, 38, .34); backdrop-filter: blur(3px); }
.auth-gate[hidden] { display: none; }
.auth-dialog { position: relative; width: min(390px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 18px 55px rgba(24, 38, 49, .22); }
.auth-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.auth-close:hover { background: #edf0f2; color: var(--ink); }
.auth-close svg { display: block; width: 17px; height: 17px; }
.auth-logo { display: block; width: 54px; height: 54px; margin: 0 auto 14px; object-fit: contain; }
.auth-dialog h1 { margin: 0; text-align: center; font-size: var(--ui-font-auth-title); font-weight: 650; }
.auth-subtitle { margin: 7px 0 20px; color: var(--muted); text-align: center; font-size: var(--ui-font-caption); line-height: 1.5; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 18px; padding: 3px; border: 1px solid var(--line); border-radius: 19px; background: #f4f6f7; }
.auth-tab { min-height: 32px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); cursor: pointer; font-size: var(--ui-font-caption); }
.auth-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(24, 38, 49, .1); font-weight: 600; }
.auth-form { display: grid; gap: 7px; }
.auth-form label { margin: 4px 4px 0; color: #465159; font-size: var(--ui-font-tiny); font-weight: 600; }
.auth-form input { width: 100%; height: 42px; padding: 0 14px; border: 1px solid #cfd7dc; border-radius: 21px; outline: 0; background: #fafbfb; color: var(--ink); font-size: var(--ui-font-auth-input); }
.auth-form input::-ms-reveal, .auth-form input::-ms-clear { display: none; }
.auth-form input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(73, 105, 168, .1); }
.password-field { position: relative; }
.password-field input { padding-right: 46px; }
.password-toggle { position: absolute; top: 50%; right: 6px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; transform: translateY(-50%); border: 0; border-radius: 50%; background: transparent; color: #68747c; cursor: pointer; }
.password-toggle:hover { background: #e9edef; color: var(--ink); }
.password-toggle svg { display: block; width: 17px; height: 17px; }
.password-toggle .eye-closed { display: none; }
.password-toggle.visible .eye-open { display: none; }
.password-toggle.visible .eye-closed { display: block; }
.confirm-field { display: grid; gap: 7px; }
.auth-error { min-height: 18px; padding: 2px 4px; color: var(--danger); font-size: var(--ui-font-tiny); line-height: 1.4; }
.auth-submit { height: 42px; border: 0; border-radius: 21px; background: var(--accent); color: #fff; cursor: pointer; font-size: var(--ui-font-small); font-weight: 600; }
.auth-submit:hover { background: #106d62; }
.auth-submit:disabled { cursor: wait; opacity: .68; }

html[data-theme="dark"] .topbar { background: rgba(29, 32, 34, .97); }
html[data-theme="dark"] .icon-btn { color: #aeb8bd; }
html[data-theme="dark"] .history-item { color: #d8dee1; }
html[data-theme="dark"] .delete-chat,
html[data-theme="dark"] .search-clear { color: #9ba6ac; }
html[data-theme="dark"] .message-sources a { color: #8eb2ff; }
html[data-theme="dark"] .model-trigger:hover:not(:disabled),
html[data-theme="dark"] .model-picker.open .model-trigger { border-color: #4a5660; background: #2b3236; color: var(--ink); }
html[data-theme="dark"] .chat-search input::placeholder,
html[data-theme="dark"] .composer textarea::placeholder { color: #9aa6ac; }
html[data-theme="dark"] .password-toggle:hover { background: #30373b; color: var(--ink); }
html[data-theme="dark"] .attachment-remove:hover,
html[data-theme="dark"] .composer-attach:hover:not(:disabled) { background: #303638; color: var(--ink); }
html[data-theme="dark"] .topbar-btn:hover:not(:disabled),
html[data-theme="dark"] .icon-btn:hover,
html[data-theme="dark"] .brand-home:hover,
html[data-theme="dark"] .history-row:hover,
html[data-theme="dark"] .account-area:hover,
html[data-theme="dark"] .answer-copy:hover { background: #292e31; }
html[data-theme="dark"] .new-chat.active,
html[data-theme="dark"] .chat-search,
html[data-theme="dark"] .history-row.active,
html[data-theme="dark"] .sign-out-btn,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .auth-dialog,
html[data-theme="dark"] .auth-tab.active { background: transparent; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .composer { background: var(--panel); border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .composer textarea,
html[data-theme="dark"] .auth-form input,
html[data-theme="dark"] .auth-form input,
html[data-theme="dark"] .auth-tabs,
html[data-theme="dark"] .compact-field input,
html[data-theme="dark"] .compact-field select,
html[data-theme="dark"] .workspace-field input,
html[data-theme="dark"] .code-editor { background: #1a1e20; border-color: var(--line); }
html[data-theme="dark"] .auth-gate { background: rgba(6, 8, 9, .58); }
html[data-theme="dark"] .auth-close:hover { background: #30373b; color: var(--ink); }
html[data-theme="dark"] .message-body { color: #e3e8ea; }
html[data-theme="dark"] .scroll-step { color: #95a1a7; }
html[data-theme="dark"] .scroll-step:hover:not(:disabled) { background: #292e31; color: var(--ink); }
html[data-theme="dark"] .scroll-track { background: #31373a; }
html[data-theme="dark"] .scroll-thumb { border-color: #31373a; background: #78858c; }
html[data-theme="dark"] .resource-links a,
html[data-theme="dark"] .account-name,
html[data-theme="dark"] .auth-form label { color: #c8d0d4; }
html[data-theme="dark"] .resource-links a:hover { color: var(--ink); }
html[data-theme="dark"] .mic-btn { color: #c2cacf; }
html[data-theme="dark"] .mic-btn:hover { background: #303638; }

html[data-theme="dark"] .new-chat.active { background: #292e31; }
html[data-theme="dark"] .new-chat:hover { background: #343a3e; }
html[data-theme="dark"] .chat-search:focus-within { background: var(--panel); }

@media (min-width: 761px) {
  html[data-theme="dark"] .chat-search { background: transparent; }
  html[data-theme="dark"] .chat-search:focus-within { background: var(--panel); }
  .sidebar-collapsed .sidebar { width: 48px; padding: 14px 6px; overflow: visible; }
  .sidebar-collapsed .brand-row { padding: 0; }
  .sidebar-collapsed .brand-home, .sidebar-collapsed .sidebar-close { display: none; }
  .sidebar-collapsed .rail-toggle { display: grid; place-items: center; }
  .sidebar-collapsed .sidebar-action { display: flex; width: 36px; min-height: 34px; padding: 0; justify-content: center; background: transparent; }
  .sidebar-collapsed .sidebar-action:hover, .sidebar-collapsed .search-shortcut:hover { background: var(--line); }
  .sidebar-collapsed .sidebar-action > span:not(.sidebar-icon), .sidebar-collapsed .history-section,
  .sidebar-collapsed .chat-search input, .sidebar-collapsed .search-clear,
  .sidebar-collapsed .account-name, .sidebar-collapsed .account-action-label,
  .sidebar-collapsed .resource-links { display: none; }
  .sidebar-collapsed .chat-search { display: block; padding: 0; margin-bottom: 0; width: 36px; }
  .sidebar-collapsed .chat-search:focus-within { background: transparent; box-shadow: none; }
  .sidebar-collapsed .search-shortcut { width: 36px; height: 34px; }
  .sidebar-collapsed .sidebar-footer { grid-row: 3; padding-top: 0; border-top: 0; }
  .sidebar-collapsed .account-area { display: block; padding: 0; }
  .sidebar-collapsed .sign-out-btn { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
  .sidebar-collapsed .sign-out-btn .sidebar-icon { display: block; }
  html[data-theme="dark"] .sidebar-collapsed .new-chat,
  html[data-theme="dark"] .sidebar-collapsed .sign-out-btn { background: transparent; }
}

@media (max-width: 1100px) {
  .composer-input { display: grid; grid-template-columns: 32px minmax(0, 1fr); }
  .composer textarea { width: 100%; }
  .composer-tools { grid-column: 2; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  .voice-actions { margin-left: auto; }
}

@media (max-width: 760px) {
  .app-shell, .app-shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: min(290px, 86vw); transform: translateX(-105%); transition: transform .18s ease; box-shadow: 8px 0 24px rgba(24, 38, 49, .12); }
  .sidebar-collapsed .sidebar { visibility: visible; }
  .sidebar.open, .sidebar-collapsed .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-btn { display: grid; }
  .topbar { padding: 0 12px; }
  .backend-state { display: none; }
  .composer-area { --composer-bottom-space: 12px; --composer-radius: 20px; padding: 10px 10px var(--composer-bottom-space); }
  .composer { padding: 7px 9px; }
  .composer-input { width: 100%; }
  .composer-tools { grid-column: 1 / -1; }
  .reasoning-menu { padding: 8px; }
  .reasoning-options { padding-right: 5px; }
  .model-column { padding-left: 5px; }
  .reasoning-option, .model-option { font-size: var(--ui-font-menu-mobile); gap: 4px; padding-left: 5px; padding-right: 5px; }
  .messages { width: calc(100% - 48px); padding-top: 18px; }
  .chat-scrollbar { right: 3px; width: 22px; }
  .message.user .message-body { max-width: 88%; }
  .empty-state { padding: 24px 18px; }
  .empty-state h1 { font-size: var(--ui-font-welcome-mobile); }
  .delete-chat { opacity: 1; }
  .auth-dialog { padding: 24px 20px; }
}

@media (max-width: 350px) {
  .composer { padding-left: 7px; padding-right: 7px; }
  .composer-input { gap: 4px; }
  .composer-tools { gap: 2px; }
  .reasoning-menu { padding: 6px; }
  .reasoning-options { padding-right: 3px; }
  .model-column { padding-left: 3px; }
  .reasoning-option, .model-option { padding-left: 3px; padding-right: 3px; gap: 3px; }
  .model-option-label { gap: 0; }
  .model-variant { grid-template-columns: 3.2em minmax(0, 1fr); gap: 0; }
}

/* Current ui chat contract aliases retained during the visual migration. */
.history-head { justify-content: space-between; }
.sign-out-btn { min-height: 30px; padding: 0 11px; border: 1px solid #d4dade; border-radius: 15px; background: #fff; color: var(--muted); cursor: pointer; font-size: var(--ui-font-tiny); }
.sign-out-btn:hover { border-color: #bbc5ca; color: var(--ink); }
/* Execution state and owned output downloads reuse the chat's existing palette. */
.execution-summary { font-size: var(--ui-font-small); opacity: .7; margin-top: 12px; }
.artifact-download { display: inline-block; background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 8px; padding: 6px 10px; margin: 6px 8px 0 0; cursor: pointer; font: inherit; font-size: var(--ui-font-small); }
.answer-code-download { margin-top: 12px; }
.answer-code-download .execution-summary { margin-bottom: 0; }
.artifact-source { max-width: 100%; min-width: 0; }

.composer-model-notice { margin: 0 auto 8px; max-width: 850px; padding: 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.workflow-control { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 0 auto 10px; max-width: 850px; padding: 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.workflow-control label { color: var(--ink); }
.workflow-control select { padding: 5px 28px 5px 10px; border: 1px solid var(--border, #dce0e4); border-radius: 8px; background: var(--panel, #fff); color: var(--ink); font: inherit; cursor: pointer; }
.workflow-control select:disabled { opacity: .55; cursor: not-allowed; }
.workflow-control select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
html[data-theme="dark"] .workflow-control select { background: #22272b; }
.model-option-label { display: block; white-space: normal; text-align: left; overflow-wrap: anywhere; }
.composer-attach:disabled { opacity: .45; cursor: not-allowed; }
.message-service-notice { margin: 12px 0 0; padding: 10px 12px; border-left: 2px solid currentColor; color: var(--muted, #747b82); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-evidence { margin-top: 14px; border-top: 1px solid var(--border, #dce0e4); padding-top: 10px; }
.message-evidence summary { cursor: pointer; font-size: 13px; color: var(--muted, #747b82); }
.message-evidence-content { margin-top: 12px; font-size: 13px; }
