﻿:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-soft: #f1f4f9;
  --text: #172033;
  --muted: #6d7b91;
  --line: #dfe5ee;
  --brand: #2563eb;
  --danger: #b42318;
  --shadow: 0 18px 46px rgba(31, 41, 55, 0.08);
  --app-height: 100vh;
  --keyboard-offset: 0px;
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    Arial,
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: 100%;
  height: var(--app-height);
  min-height: 0;
  overflow: hidden;
}

.chat-sidebar {
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #eef2f8;
}

.mobile-sidebar-toggle,
.mobile-sidebar-close,
.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  font-weight: 900;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
}

.new-chat {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-weight: 800;
}

.project-box {
  display: grid;
  gap: 7px;
}

.project-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.project-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px 38px;
  gap: 8px;
}

.project-control select,
.project-control button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
}

.project-control select {
  min-width: 0;
  padding: 0 10px;
  cursor: pointer;
  font-weight: 800;
}

.project-control button {
  cursor: pointer;
  font-size: 20px;
  font-weight: 500;
}

.thread-search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--text);
  background: var(--panel);
  outline: 0;
}

.thread-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.empty-thread {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: 8px;
}

.thread-row:hover,
.thread-row.is-active {
  background: var(--panel);
}

.thread-item {
  display: block;
  overflow: hidden;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-item:hover,
.thread-row.is-active .thread-item {
  color: var(--text);
}

.thread-actions {
  display: none;
  gap: 4px;
  padding-right: 6px;
}

.thread-row:hover .thread-actions,
.thread-row.is-active .thread-actions {
  display: flex;
}

.thread-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.chat-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.chat-topbar {
  position: relative;
  z-index: 16;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 251, 0.92);
  backdrop-filter: blur(14px);
}

.back-link {
  color: var(--muted);
  font-weight: 800;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.model-select {
  min-width: 190px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: var(--panel);
  font-weight: 800;
}

.settings-button,
.share-button,
.install-button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  cursor: pointer;
  background: var(--panel);
  font-weight: 800;
}

.share-button.is-active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.install-button {
  display: none;
}

.install-button.is-visible {
  display: inline-grid;
  place-items: center;
}

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.32);
}

.install-modal[hidden] {
  display: none;
}

.install-panel {
  position: relative;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--text);
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.install-panel strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.install-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.install-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  background: #fff;
  font-size: 20px;
}

.share-toolbar {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.share-toolbar[hidden] {
  display: none;
}

.share-toolbar-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.share-toolbar-main strong {
  font-size: 14px;
}

.share-toolbar-main span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.share-actions,
.share-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.share-link-box {
  grid-column: 1 / -1;
}

.share-link-box[hidden] {
  display: none;
}

.share-link-box input {
  min-width: 0;
  flex: 1;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--text);
  background: #f8fafc;
}

.primary-action,
.secondary-action,
.primary-link {
  display: inline-grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 900;
}

.secondary-action {
  color: var(--text);
  background: #fff;
}

.primary-action,
.primary-link {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 36px 22px 24px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.messages.is-loading {
  opacity: 0.62;
  pointer-events: none;
}

.thread-skeleton {
  display: grid;
  gap: 26px;
  width: min(920px, 100%);
  margin: 0 auto;
}

.skeleton-row {
  display: grid;
  gap: 10px;
  width: min(720px, 86%);
}

.skeleton-row.is-wide {
  justify-self: end;
  width: min(760px, 78%);
}

.skeleton-row span {
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e7edf6 0%, #f4f7fb 42%, #e7edf6 78%);
  background-size: 220% 100%;
  animation: skeleton-pulse 1.25s ease-in-out infinite;
}

.skeleton-row span:nth-child(2) {
  width: 84%;
}

.skeleton-row span:nth-child(3) {
  width: 56%;
}

@keyframes skeleton-pulse {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.empty-state {
  display: grid;
  min-height: 55vh;
  place-items: center;
  text-align: center;
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.12;
  letter-spacing: 0;
}

.message {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 760px);
  gap: 14px;
  width: min(920px, 100%);
  margin: 0 auto 26px;
}

.message.is-user {
  grid-template-columns: minmax(0, 760px) 34px;
  justify-content: end;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: #111827;
  font-size: 13px;
  font-weight: 900;
}

.message.is-user .avatar {
  grid-column: 2;
  background: var(--brand);
}

.bubble {
  min-width: 0;
  padding: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
}

.message-body {
  overflow-wrap: anywhere;
}

.message-body p {
  margin: 0 0 12px;
}

.message-body p:last-child,
.message-body ul:last-child,
.message-body ol:last-child {
  margin-bottom: 0;
}

.message-body h1,
.message-body h2,
.message-body h3 {
  margin: 18px 0 10px;
  line-height: 1.35;
}

.message-body h1 {
  font-size: 24px;
}

.message-body h2 {
  font-size: 21px;
}

.message-body h3 {
  font-size: 18px;
}

.message-body ul,
.message-body ol {
  margin: 0 0 12px;
  padding-left: 24px;
}

.message-body code {
  border-radius: 5px;
  padding: 2px 5px;
  background: #eef2f8;
  font-size: 0.92em;
}

.message-body a {
  color: var(--brand);
  font-weight: 800;
}

.chat-image {
  display: block;
  max-width: min(100%, 520px);
  max-height: 520px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message-body table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}

.message-body th,
.message-body td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.message-body th {
  background: #f4f7fb;
  font-weight: 900;
}

.code-block {
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid #d3dbe8;
  border-radius: 8px;
  background: #111827;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  color: #cbd5e1;
  background: #0b1220;
  font-size: 12px;
}

.code-head button,
.message-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 8px;
  color: var(--muted);
  cursor: pointer;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.code-block pre {
  overflow-x: auto;
  margin: 0;
  padding: 14px;
}

.code-block code {
  padding: 0;
  color: #e5e7eb;
  background: transparent;
  white-space: pre;
}

.message.is-user .bubble {
  grid-column: 1;
  justify-self: end;
  max-width: 680px;
  padding: 12px 16px;
  border: 1px solid #cfe0ff;
  border-radius: 18px;
  background: #eef5ff;
}

.message.is-error .bubble {
  color: var(--danger);
}

.thinking-path {
  display: grid;
  gap: 12px;
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
}

.thinking-path-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.thinking-path-head strong {
  font-size: 14px;
}

.thinking-path-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.thinking-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.38);
  animation: thinkingPulse 1.2s ease-in-out infinite;
}

.thinking-path ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.thinking-path li {
  position: relative;
  min-height: 24px;
  padding-left: 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.thinking-path li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 2px;
  width: 12px;
  height: 12px;
  border: 2px solid #c9d5e7;
  border-radius: 999px;
  background: #fff;
}

.thinking-path li.is-active {
  color: var(--text);
  font-weight: 900;
}

.thinking-path li.is-active::before {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.thinking-path li.is-done {
  color: #3d5679;
}

.thinking-path li.is-done::before {
  border-color: var(--brand);
  background: var(--brand);
}

@keyframes thinkingPulse {
  0% {
    transform: scale(0.86);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.38);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }

  100% {
    transform: scale(0.86);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.message.is-share-pair .bubble {
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.message.is-share-pair:not(.is-user) .bubble {
  border-radius: 12px;
  padding: 8px 10px;
}

.message.is-share-selected .bubble {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.22);
}

.message.is-share-selected:not(.is-user) .bubble {
  background: #f4f8ff;
}

.share-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin: 0 0 8px;
  border: 1px solid #b9cffb;
  border-radius: 999px;
  padding: 0 9px;
  color: #174ea6;
  cursor: pointer;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.share-check strong {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-size: 11px;
}

.message.is-share-selected .share-check {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.message.is-share-selected .share-check strong {
  color: var(--brand);
  background: #fff;
}

.message-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.source-cards {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.artifact-cards {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.source-cards-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.source-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
}

.source-card strong {
  color: var(--text);
  font-size: 13px;
}

.source-card span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.source-card em {
  color: #0f4c81;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.artifact-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.artifact-card img,
.artifact-file-icon {
  width: 132px;
  height: 82px;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
}

.artifact-file-icon {
  display: grid;
  place-items: center;
  color: #0f4c81;
  background: #eef5ff;
  font-size: 18px;
  font-weight: 900;
}

.artifact-card strong {
  display: block;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.artifact-actions a {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.composer-wrap {
  position: relative;
  z-index: 12;
  flex: 0 0 auto;
  padding: 14px 22px 22px;
  background: linear-gradient(180deg, rgba(247, 248, 251, 0), var(--bg) 28%);
}

.composer,
.attachment-list {
  width: min(880px, 100%);
  margin: 0 auto;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer.is-dragover {
  border-color: var(--brand);
  background: #f4f8ff;
}

.composer textarea {
  width: 100%;
  max-height: 180px;
  min-height: 46px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 12px 10px;
  color: var(--text);
  background: transparent;
  line-height: 1.55;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-menu {
  position: relative;
}

.tool-menu-button.is-active {
  color: #0f4c81;
  background: #e6f0ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.24);
}

.tool-menu-button.is-active::after {
  content: attr(data-active-count);
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-size: 11px;
  font-weight: 900;
}

.tool-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 460px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.16);
}

.tool-popover[hidden] {
  display: none;
}

.tool-popover-head {
  display: grid;
  gap: 3px;
  grid-column: 1 / -1;
  padding: 4px 6px;
}

.tool-popover-head strong {
  font-size: 13px;
}

.tool-popover-head span {
  color: var(--muted);
  font-size: 12px;
}

.tool-option {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  width: 100%;
  min-height: 68px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 34px 10px 11px;
  color: var(--text);
  cursor: pointer;
  background: #f8fafc;
  text-align: left;
}

.tool-option:hover {
  border-color: #cdd8ea;
  background: #f3f7fd;
}

.tool-option span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tool-option.is-active {
  color: #0f4c81;
  background: #e6f0ff;
  border-color: rgba(37, 99, 235, 0.28);
}

.tool-option.is-active::after {
  content: "✓";
  position: absolute;
  top: 50%;
  right: 12px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  transform: translateY(-50%);
}

.image-tool-options {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  border-top: 1px solid var(--line);
  padding: 10px 6px 2px;
}

.image-tool-options label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.image-tool-options select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--text);
  background: #fff;
  font-weight: 800;
}

.image-reference-row {
  grid-column: 1 / -1;
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: var(--text) !important;
}

.mode-select-wrap {
  display: inline-flex;
  align-items: center;
}

.mode-select-wrap select {
  width: 92px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 8px;
  color: var(--text);
  cursor: pointer;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.icon-button,
.send-button,
.stop-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: var(--panel-soft);
}

.send-button {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.image-button {
  color: #1f7a4d;
  background: #eefbf4;
}

.stop-button {
  border-color: #fecaca;
  color: var(--danger);
  background: #fff7f7;
}

.stop-button[hidden],
.send-button[hidden] {
  display: none;
}

.send-button:disabled,
.stop-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.icon-button svg,
.send-button svg,
.stop-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(100%, 520px);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
}

.attachment-chip.is-pending {
  opacity: 0.72;
}

.attachment-chip.is-error {
  border-color: #fecaca;
  color: var(--danger);
  background: #fff7f7;
}

.attachment-name {
  overflow: hidden;
  max-width: 260px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  color: var(--muted);
  white-space: nowrap;
}

.attachment-remove {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  background: #eef2f8;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: #111827;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.memory-notice {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 29;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
}

.memory-notice[hidden] {
  display: none;
}

.memory-notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.memory-notice-head button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
}

.memory-notice p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.memory-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-notice-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  font-weight: 900;
}

.memory-notice-actions button:first-child {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 31;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.34);
}

.project-modal[hidden] {
  display: none;
}

.project-panel {
  display: grid;
  gap: 16px;
  width: min(820px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.project-head,
.project-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-head {
  font-size: 18px;
}

.project-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  font-size: 20px;
}

.project-section {
  display: grid;
  gap: 12px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

.field textarea {
  resize: vertical;
}

.project-file-list {
  display: grid;
  gap: 8px;
  min-height: 120px;
}

.project-file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.project-file-main {
  min-width: 0;
}

.project-file-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-file-main span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.project-file-actions {
  display: grid;
  grid-template-columns: auto auto 160px;
  gap: 8px;
  align-items: center;
}

.project-file-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.project-file-actions button:nth-child(2) {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff7f7;
}

.project-file-item select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--text);
  background: #fff;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.36);
}

.settings-modal[hidden] {
  display: none;
}

.settings-panel {
  display: grid;
  gap: 16px;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 18px;
}

.settings-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  font-size: 20px;
}

.settings-section {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field select,
.memory-form input,
.memory-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

.memory-form textarea {
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.settings-subsection {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.primary-action,
.secondary-action,
.danger-action,
.memory-form button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 900;
}

.primary-action {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.secondary-action {
  color: var(--text);
  background: #fff;
}

.danger-action {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff7f7;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.memory-head strong {
  display: block;
  margin-bottom: 4px;
}

.memory-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.memory-form {
  display: grid;
  gap: 8px;
}

.memory-list,
.memory-event-list,
.log-list {
  display: grid;
  gap: 12px;
  max-height: 280px;
  overflow: auto;
}

.memory-events {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.memory-group {
  display: grid;
  gap: 8px;
}

.memory-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
}

.memory-group-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.memory-group-list {
  display: grid;
  gap: 8px;
}

.memory-item,
.memory-event-item,
.log-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.log-item {
  grid-template-columns: 1fr;
}

.log-item.is-error {
  border-color: #fecaca;
  background: #fff7f7;
}

.memory-item.is-disabled {
  opacity: 0.62;
}

.memory-event-item.is-reverted {
  opacity: 0.68;
}

.memory-main strong,
.log-item strong {
  display: block;
  margin-bottom: 4px;
}

.memory-main p,
.log-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.memory-main small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.memory-actions {
  display: flex;
  gap: 6px;
}

.memory-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  cursor: pointer;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.empty-memory {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 42;
    display: flex;
    width: min(86vw, 340px);
    max-width: 100%;
    padding: 16px;
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 48px rgba(15, 23, 42, 0.18);
  }

  body.is-sidebar-open .chat-sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 41;
    display: block;
    border: 0;
    background: rgba(15, 23, 42, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.is-sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-sidebar-toggle {
    display: inline-grid;
    flex: 0 0 auto;
    min-width: 52px;
    min-height: 36px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    color: var(--text);
    cursor: pointer;
    background: #fff;
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-sidebar-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    background: #fff;
    font-size: 20px;
  }

  .chat-topbar {
    gap: 6px;
    min-height: 54px;
    padding: 8px 10px;
    overflow: hidden;
  }

  .back-link {
    flex: 0 0 auto;
    max-width: 42px;
    overflow: hidden;
    padding: 0 2px;
    font-size: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .back-link::after {
    content: "首页";
    font-size: 13px;
  }

  .topbar-controls {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .topbar-controls::-webkit-scrollbar {
    display: none;
  }

  .select-wrap {
    flex: 0 0 auto;
    gap: 0;
  }

  .select-wrap span {
    display: none;
  }

  .model-select {
    width: 116px;
    min-width: 116px;
    height: 36px;
    padding: 0 7px;
    font-size: 13px;
  }

  .settings-button,
  .share-button,
  .install-button {
    flex: 0 0 auto;
    width: auto;
    height: 36px;
    padding: 0 9px;
    font-size: 13px;
    white-space: nowrap;
  }

  .messages {
    padding: 22px 14px 16px;
    scroll-padding-bottom: calc(126px + env(safe-area-inset-bottom));
  }

  body.is-keyboard-open .messages {
    padding-bottom: calc(154px + var(--keyboard-offset) + env(safe-area-inset-bottom));
  }

  .share-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 10px;
  }

  .share-toolbar-main {
    overflow: hidden;
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .share-toolbar-main strong,
  .share-toolbar-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .share-actions,
  .share-link-box {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .share-actions button,
  .share-link-box button,
  .share-link-box a {
    flex: 0 0 auto;
    min-height: 34px;
    padding-inline: 10px;
    white-space: nowrap;
  }

  .share-link-box input {
    flex: 1 1 100%;
    min-width: 160px;
  }

  .message,
  .message.is-user {
    grid-template-columns: 1fr;
  }

  .avatar {
    display: none;
  }

  .message.is-user .bubble {
    grid-column: auto;
  }

  .message.is-share-pair:not(.is-user) .bubble {
    padding: 8px;
  }

  .thinking-path {
    max-width: 100%;
  }

  .thinking-path-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .composer-wrap {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: #ffffff;
    box-shadow: none;
    transform: translateY(calc(var(--keyboard-offset) * -1));
    transition: transform 140ms ease;
    will-change: transform;
  }

  body.is-keyboard-open .chat-topbar {
    min-height: 46px;
    padding-block: 6px;
  }

  body.is-keyboard-open .empty-state {
    min-height: 32vh;
    align-items: start;
    padding-top: 18vh;
  }

  .memory-notice {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }

  .attachment-list {
    width: 100%;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 6px;
    overflow-x: auto;
    padding: 0 1px 2px;
    scrollbar-width: none;
  }

  .attachment-list::-webkit-scrollbar {
    display: none;
  }

  .attachment-chip {
    flex: 0 0 auto;
    max-width: min(78vw, 320px);
    min-height: 34px;
    border-radius: 999px;
    padding: 6px 9px;
  }

  .attachment-name {
    white-space: nowrap;
  }

  .composer {
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
    padding: 8px;
    border-radius: 22px;
  }

  .composer textarea {
    min-height: 42px;
    max-height: 132px;
    padding: 8px 8px 2px;
    font-size: 16px;
    line-height: 1.45;
  }

  .composer-actions {
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .tool-menu {
    order: 1;
    flex: 0 0 auto;
  }

  .composer-actions [data-upload-trigger] {
    order: 2;
    flex: 0 0 auto;
  }

  .mode-select-wrap {
    order: 3;
    flex: 0 1 auto;
    min-width: 0;
  }

  .mode-select-wrap select {
    width: 92px;
    height: 34px;
    border-radius: 999px;
    padding: 0 8px;
    font-size: 12px;
  }

  .icon-button,
  .send-button,
  .stop-button {
    width: 36px;
    height: 36px;
    border-radius: 999px;
  }

  .icon-button svg,
  .send-button svg,
  .stop-button svg {
    width: 18px;
    height: 18px;
  }

  .send-button,
  .stop-button {
    order: 10;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .tool-popover {
    grid-template-columns: 1fr;
    width: min(304px, calc(100vw - 28px));
    max-height: min(68vh, 520px);
    overflow-y: auto;
    border-radius: 16px;
  }

  .image-tool-options {
    grid-template-columns: 1fr;
  }

  .artifact-card {
    grid-template-columns: 1fr;
  }

  .artifact-card img,
  .artifact-file-icon {
    width: 100%;
    height: 120px;
  }

  .memory-item,
  .memory-event-item {
    grid-template-columns: 1fr;
  }

  .memory-head,
  .memory-group-head {
    align-items: stretch;
    flex-direction: column;
  }

  .memory-group-head span {
    text-align: left;
  }

  .project-file-item {
    grid-template-columns: 1fr;
  }

  .project-file-actions {
    grid-template-columns: 1fr;
  }

  .memory-actions {
    flex-wrap: wrap;
  }
}

/* Visual refresh aligned with the ETF tools: quieter panels, lighter typography, restrained controls. */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #e5e7eb;
  --brand: #2563eb;
  --danger: #dc2626;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  background: var(--bg);
  font-size: 15px;
}

.chat-sidebar {
  gap: 12px;
  padding: 18px 16px;
  background: #f8fafc;
}

.brand {
  min-height: 38px;
  font-size: 15px;
  font-weight: 700;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.new-chat {
  min-height: 38px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
  box-shadow: none;
}

.project-label,
.source-cards-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.project-control select,
.project-control button,
.thread-search input,
.model-select,
.settings-button,
.share-button,
.install-button,
.secondary-action,
.primary-action,
.danger-action,
.memory-form button {
  border-color: var(--line);
  border-radius: 6px;
  font-weight: 650;
}

.project-control select,
.thread-search input,
.model-select {
  background: #fff;
}

.thread-list {
  gap: 4px;
}

.thread-row {
  border-radius: 6px;
}

.thread-row:hover,
.thread-row.is-active {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.8);
}

.thread-item {
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.chat-topbar {
  min-height: 58px;
  padding: 10px 22px;
  background: rgba(245, 247, 251, 0.96);
  backdrop-filter: blur(10px);
}

.back-link,
.select-wrap,
.model-select,
.settings-button,
.share-button,
.install-button {
  font-weight: 650;
}

.model-select,
.settings-button,
.share-button,
.install-button {
  height: 38px;
  font-size: 14px;
}

.messages {
  padding-top: 30px;
}

.empty-state h1 {
  color: #1f2937;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.22;
}

.message {
  grid-template-columns: 30px minmax(0, 760px);
  gap: 12px;
  margin-bottom: 22px;
}

.message.is-user {
  grid-template-columns: minmax(0, 720px) 30px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.bubble {
  font-size: 15px;
  line-height: 1.72;
}

.message.is-user .bubble {
  max-width: 640px;
  padding: 10px 13px;
  border-color: #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
}

.message-body h1,
.message-body h2,
.message-body h3 {
  font-weight: 700;
}

.message-body h1 {
  font-size: 21px;
}

.message-body h2 {
  font-size: 19px;
}

.message-body h3 {
  font-size: 17px;
}

.message-body a {
  font-weight: 650;
}

.table-wrap,
.code-block,
.chat-image,
.source-card,
.artifact-card,
.thinking-path {
  border-radius: 8px;
}

.message-body th {
  background: #f8fafc;
  font-weight: 650;
}

.code-head button,
.message-actions button,
.artifact-actions a,
.thread-actions button {
  border-radius: 6px;
  font-weight: 650;
}

.message-meta {
  color: #94a3b8;
  font-size: 12px;
}

.composer-wrap {
  padding: 12px 22px 20px;
  background: linear-gradient(180deg, rgba(245, 247, 251, 0), var(--bg) 32%);
}

.composer {
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.composer textarea {
  min-height: 44px;
  padding: 10px 8px;
  font-size: 15px;
  line-height: 1.55;
}

.tool-popover,
.settings-panel,
.project-panel,
.install-panel {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-popover {
  width: 440px;
  border-color: var(--line);
}

.tool-option {
  min-height: 64px;
  border-radius: 6px;
  background: #f8fafc;
}

.tool-option:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.tool-option.is-active,
.tool-menu-button.is-active {
  color: #1d4ed8;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.image-tool-options select,
.mode-select-wrap select {
  border-radius: 6px;
  font-weight: 650;
}

.icon-button,
.send-button,
.stop-button {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #f8fafc;
}

.send-button {
  color: #fff;
  background: var(--brand);
}

.settings-head {
  font-size: 17px;
  font-weight: 700;
}

.field,
.check-row {
  font-weight: 650;
}

@media (max-width: 820px) {
  .chat-sidebar {
    background: #f8fafc;
    box-shadow: 14px 0 34px rgba(15, 23, 42, 0.14);
  }

  .mobile-sidebar-toggle,
  .mobile-sidebar-close,
  .settings-button,
  .share-button,
  .install-button {
    border-radius: 6px;
    font-weight: 650;
  }

  .chat-topbar {
    min-height: 52px;
    background: rgba(245, 247, 251, 0.98);
  }

  .messages {
    padding-top: 20px;
  }

  .message {
    margin-bottom: 20px;
  }

  .message.is-user .bubble {
    border-radius: 8px;
  }

  .composer {
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }

  .mode-select-wrap select,
  .icon-button,
  .send-button,
  .stop-button {
    border-radius: 6px;
  }

  .tool-popover {
    border-radius: 8px;
  }
}

/* White workspace pass: remove the blue-gray cast and make navigation typography quieter. */
:root {
  --bg: #ffffff;
  --panel-soft: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --line: #e5e7eb;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

body,
.chat-main,
.messages,
.chat-topbar,
.composer-wrap {
  background: #ffffff;
}

.chat-sidebar {
  background: #ffffff;
}

.chat-topbar {
  background: #ffffff;
}

.composer-wrap {
  background: #ffffff;
}

.brand,
.new-chat,
.project-control select,
.thread-search input,
.thread-item,
.mobile-sidebar-toggle,
.settings-button,
.share-button,
.install-button {
  font-weight: 400;
}

.brand {
  color: #111827;
}

.new-chat {
  justify-content: start;
  place-items: center start;
  padding: 0 12px;
  border-color: transparent;
  background: #ffffff;
}

.new-chat:hover {
  border-color: var(--line);
  background: #f9fafb;
}

.project-label {
  font-weight: 400;
}

.thread-row:hover,
.thread-row.is-active {
  background: #f9fafb;
  box-shadow: none;
}

.thread-item,
.thread-row.is-active .thread-item,
.thread-item:hover {
  color: #111827;
}

.thread-actions button {
  font-weight: 400;
}

.model-select,
.mode-select-wrap select,
.tool-option strong,
.message-actions button,
.code-head button {
  font-weight: 500;
}

@media (max-width: 820px) {
  .chat-sidebar,
  .chat-topbar,
  .composer-wrap {
    background: #ffffff;
  }

  .composer-wrap {
    background: #ffffff;
  }
}

/* ChatGPT-style action and composer pass. */
.topbar-controls [data-share-open] {
  display: none;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
}

.message-actions .message-action-icon,
.message-actions button.message-action-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #6b7280;
  cursor: pointer;
  background: transparent;
  font-size: 0;
  font-weight: 400;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.message-actions .message-action-icon:hover,
.message-actions button.message-action-icon:hover {
  color: #111827;
  background: #f3f4f6;
}

.message-actions .message-action-icon:active,
.message-actions button.message-action-icon:active {
  transform: scale(0.96);
}

.message-actions .message-action-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-wrap {
  padding: 12px 22px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 28%);
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  width: min(820px, 100%);
  min-height: 60px;
  border: 1px solid #d9d9d9;
  border-radius: 30px;
  padding: 8px 10px 8px 52px;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

.composer:focus-within {
  border-color: #c7c7c7;
  box-shadow: 0 3px 18px rgba(15, 23, 42, 0.1);
}

.composer textarea {
  min-height: 42px;
  max-height: 180px;
  padding: 10px 2px 8px;
  color: #111827;
  font-size: 15px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #8b949e;
}

.composer-actions {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 6px;
  min-height: 42px;
}

.tool-menu {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
}

.tool-menu-button,
.composer .tool-menu-button.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: #4b5563;
  background: transparent;
  box-shadow: none;
}

.tool-menu-button:hover,
.composer .tool-menu-button.icon-button:hover {
  color: #111827;
  background: #f3f4f6;
}

.tool-menu-button.is-active,
.composer .tool-menu-button.icon-button.is-active {
  color: #111827;
  background: #f3f4f6;
  box-shadow: none;
}

.tool-menu-button svg {
  width: 20px;
  height: 20px;
}

.tool-menu-button.is-active::after {
  top: -1px;
  right: -1px;
}

.tool-popover {
  left: 0;
  bottom: calc(100% + 10px);
}

.mode-select-wrap select {
  width: auto;
  min-width: 70px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 26px 0 10px;
  color: #374151;
  background-color: transparent;
  font-size: 13px;
  font-weight: 400;
}

.mode-select-wrap select:hover {
  background-color: #f3f4f6;
}

.composer [data-upload-trigger].icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  color: #4b5563;
  background: transparent;
}

.composer [data-upload-trigger].icon-button:hover {
  color: #111827;
  background: #f3f4f6;
}

.send-button,
.composer .send-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #111827;
  box-shadow: none;
}

.send-button:hover,
.composer .send-button:hover {
  background: #000000;
}

.send-button svg,
.composer .send-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.stop-button,
.composer .stop-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #111827;
}

.stop-button:hover,
.composer .stop-button:hover {
  background: #000000;
}

.send-button[hidden],
.stop-button[hidden] {
  display: none;
}

@media (max-width: 820px) {
  .composer-wrap {
    padding: 10px max(12px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
    background: #ffffff;
  }

  .composer {
    width: 100%;
    min-height: 56px;
    border-radius: 28px;
    padding: 7px 8px 7px 48px;
  }

  .composer textarea {
    min-height: 40px;
    padding-top: 9px;
    font-size: 16px;
  }

  .composer-actions {
    gap: 4px;
    min-height: 40px;
  }

  .tool-menu {
    left: 8px;
    bottom: 8px;
  }

  .tool-menu-button,
  .composer .tool-menu-button.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 999px;
  }

  .mode-select-wrap select {
    max-width: 74px;
    height: 32px;
    padding-left: 8px;
    padding-right: 22px;
    font-size: 12px;
  }

  .composer [data-upload-trigger].icon-button,
  .send-button,
  .composer .send-button,
  .stop-button,
  .composer .stop-button {
    width: 34px;
    height: 34px;
    border-radius: 999px;
  }

  .tool-popover {
    left: -2px;
    width: min(320px, calc(100vw - 24px));
    border-radius: 18px;
  }
}

/* Sidebar and default-search polish. */
.chat-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.chat-sidebar {
  gap: 8px;
  padding: 10px 8px;
  border-right: 0;
  background: #f9f9f9;
}

.brand {
  min-height: 40px;
  padding: 0 8px;
  border-radius: 10px;
  color: #171717;
  font-size: 14px;
  font-weight: 500;
}

.brand:hover {
  background: #ececec;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #111827;
  font-size: 13px;
  font-weight: 600;
}

.new-chat {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  color: #171717;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  box-shadow: none;
}

.new-chat:hover {
  border-color: transparent;
  background: #ececec;
}

.project-box {
  gap: 6px;
  margin-top: 4px;
  padding: 4px 4px 2px;
}

.project-label {
  padding: 0 6px;
  color: #8a8a8a;
  font-size: 12px;
  font-weight: 400;
}

.project-control {
  grid-template-columns: minmax(0, 1fr) 32px 32px;
  gap: 4px;
}

.project-control select,
.project-control button,
.thread-search input {
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.project-control select {
  padding: 0 8px;
  color: #171717;
  font-size: 13px;
  font-weight: 400;
}

.project-control button {
  color: #4b5563;
  font-size: 16px;
  font-weight: 400;
}

.project-control select:hover,
.project-control button:hover {
  background: #ececec;
}

.thread-search {
  margin: 4px 4px 2px;
}

.thread-search input {
  padding: 0 10px;
  color: #171717;
  background: #ffffff;
  font-size: 13px;
}

.thread-search input:focus {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #d6d6d6;
}

.thread-list {
  gap: 2px;
  padding: 2px 2px 8px;
}

.empty-thread {
  margin: 6px 4px;
  border: 0;
  border-radius: 10px;
  padding: 12px 10px;
  color: #8a8a8a;
  background: transparent;
  font-size: 13px;
}

.thread-row {
  border-radius: 10px;
}

.thread-row:hover,
.thread-row.is-active {
  background: #ececec;
  box-shadow: none;
}

.thread-item,
.thread-row.is-active .thread-item,
.thread-item:hover {
  color: #171717;
}

.thread-item {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
}

.thread-actions {
  gap: 2px;
  padding-right: 4px;
}

.thread-actions button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  color: #6b7280;
  background: transparent;
  font-weight: 400;
}

.thread-actions button:hover {
  color: #171717;
  background: #e0e0e0;
}

.composer {
  width: min(800px, 100%);
  padding-left: 44px;
}

.tool-menu {
  left: 6px;
}

[data-tool-web-search],
[data-default-web-search-enabled] {
  display: none !important;
}

@media (max-width: 820px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    width: min(88vw, 320px);
    padding: 10px 8px;
    background: #f9f9f9;
  }

  .mobile-sidebar-toggle,
  .mobile-sidebar-close {
    border: 0;
    border-radius: 10px;
    color: #171717;
    background: transparent;
    font-size: 14px;
    font-weight: 400;
  }

  .mobile-sidebar-toggle:hover,
  .mobile-sidebar-close:hover {
    background: #ececec;
  }

  .composer {
    padding-left: 42px;
  }

  .tool-menu {
    left: 5px;
  }
}

/* Mobile answer width and background-resume fix. */
@media (max-width: 820px) {
  .messages {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .message,
  .message.is-user,
  .message.is-assistant {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 0 !important;
    margin-left: 0;
    margin-right: 0;
  }

  .message .avatar {
    display: none !important;
  }

  .message .bubble,
  .message.is-user .bubble,
  .message.is-assistant .bubble,
  .message.is-share-pair:not(.is-user) .bubble {
    grid-column: 1 / -1 !important;
    justify-self: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
  }

  .message.is-assistant .bubble {
    padding: 0 !important;
  }

  .message.is-user .bubble {
    padding: 12px 14px !important;
    border-radius: 14px !important;
  }

  .message-body,
  .message-body p,
  .message-meta,
  .thinking-path,
  .source-cards,
  .artifact-cards,
  .message-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
  }

  .thinking-path {
    box-sizing: border-box;
  }

  .message-actions {
    flex-wrap: wrap;
  }
}

/* Cute white-cat thinking animation, drawn in CSS instead of using branded assets. */
.thinking-hero {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.kitty-thinker {
  position: relative;
  width: 72px;
  height: 64px;
  animation: kittyFloat 1.8s ease-in-out infinite;
}

.kitty-face {
  position: absolute;
  left: 7px;
  bottom: 3px;
  width: 58px;
  height: 46px;
  border: 2px solid #262626;
  border-radius: 48% 48% 44% 44%;
  background: #fff;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.1);
}

.kitty-ear {
  position: absolute;
  z-index: 0;
  top: 12px;
  width: 18px;
  height: 20px;
  border: 2px solid #262626;
  border-bottom: 0;
  background: #fff;
}

.kitty-ear-left {
  left: 11px;
  border-radius: 16px 4px 0 0;
  transform: rotate(-28deg);
}

.kitty-ear-right {
  right: 11px;
  border-radius: 4px 16px 0 0;
  transform: rotate(28deg);
}

.kitty-eye {
  position: absolute;
  top: 22px;
  width: 5px;
  height: 7px;
  border-radius: 999px;
  background: #111827;
  animation: kittyBlink 3.2s ease-in-out infinite;
}

.kitty-eye-left {
  left: 18px;
}

.kitty-eye-right {
  right: 18px;
}

.kitty-nose {
  position: absolute;
  left: 50%;
  top: 28px;
  width: 7px;
  height: 5px;
  border-radius: 999px;
  background: #f3c15f;
  transform: translateX(-50%);
}

.kitty-whisker {
  position: absolute;
  top: 29px;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #111827;
}

.kitty-whisker-left-a {
  left: 3px;
  transform: rotate(8deg);
}

.kitty-whisker-left-b {
  left: 3px;
  top: 35px;
  transform: rotate(-7deg);
}

.kitty-whisker-right-a {
  right: 3px;
  transform: rotate(-8deg);
}

.kitty-whisker-right-b {
  right: 3px;
  top: 35px;
  transform: rotate(7deg);
}

.kitty-bow {
  position: absolute;
  top: -8px;
  right: 5px;
  width: 23px;
  height: 16px;
  transform: rotate(10deg);
}

.kitty-bow i,
.kitty-bow b {
  position: absolute;
  display: block;
  background: #ef4444;
}

.kitty-bow i {
  top: 2px;
  width: 12px;
  height: 12px;
  border: 2px solid #b91c1c;
  border-radius: 9px 4px 9px 4px;
}

.kitty-bow i:first-child {
  left: 0;
  transform: rotate(-18deg);
}

.kitty-bow i:nth-child(2) {
  right: 0;
  transform: rotate(18deg) scaleX(-1);
}

.kitty-bow b {
  left: 9px;
  top: 5px;
  width: 7px;
  height: 8px;
  border: 2px solid #b91c1c;
  border-radius: 999px;
}

.kitty-thought {
  position: absolute;
  border: 2px solid #d8dee8;
  border-radius: 999px;
  background: #fff;
  opacity: 0.45;
  animation: kittyThought 1.6s ease-in-out infinite;
}

.kitty-thought-one {
  top: 3px;
  right: 4px;
  width: 7px;
  height: 7px;
  animation-delay: 0s;
}

.kitty-thought-two {
  top: -6px;
  right: 14px;
  width: 10px;
  height: 10px;
  animation-delay: 0.18s;
}

.kitty-thought-three {
  top: -18px;
  right: 28px;
  width: 15px;
  height: 15px;
  animation-delay: 0.36s;
}

@keyframes kittyFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-4px) rotate(1deg);
  }
}

@keyframes kittyBlink {
  0%,
  88%,
  100% {
    transform: scaleY(1);
  }

  92%,
  96% {
    transform: scaleY(0.16);
  }
}

@keyframes kittyThought {
  0% {
    opacity: 0.25;
    transform: translateY(3px) scale(0.82);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }

  100% {
    opacity: 0.25;
    transform: translateY(-6px) scale(0.88);
  }
}

@media (max-width: 820px) {
  .thinking-hero {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
  }

  .kitty-thinker {
    width: 56px;
    height: 52px;
    transform-origin: center bottom;
  }

  .kitty-face {
    left: 5px;
    width: 46px;
    height: 37px;
  }

  .kitty-ear {
    top: 11px;
    width: 14px;
    height: 16px;
  }

  .kitty-ear-left {
    left: 8px;
  }

  .kitty-ear-right {
    right: 8px;
  }

  .kitty-eye {
    top: 18px;
    width: 4px;
    height: 6px;
  }

  .kitty-eye-left {
    left: 14px;
  }

  .kitty-eye-right {
    right: 14px;
  }

  .kitty-nose {
    top: 23px;
    width: 6px;
    height: 4px;
  }

  .kitty-whisker {
    top: 24px;
    width: 11px;
  }

  .kitty-whisker-left-b,
  .kitty-whisker-right-b {
    top: 29px;
  }

  .kitty-bow {
    top: -7px;
    right: 2px;
    transform: rotate(10deg) scale(0.82);
  }

  .kitty-thought-one {
    top: 2px;
    right: 0;
  }

  .kitty-thought-two {
    top: -6px;
    right: 8px;
  }

  .kitty-thought-three {
    top: -16px;
    right: 20px;
  }
}

/* ChatGPT-style bubbles without message avatars. */
.message,
.message.is-user,
.message.is-assistant {
  display: flex !important;
  width: min(820px, 100%) !important;
  max-width: 100% !important;
  grid-template-columns: none !important;
  gap: 0 !important;
  margin: 0 auto 24px;
}

.message .avatar {
  display: none !important;
}

.message .bubble,
.message.is-user .bubble,
.message.is-assistant .bubble {
  grid-column: auto !important;
  min-width: 0 !important;
  color: #111827;
  font-size: 15px;
  line-height: 1.75;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

.message.is-assistant {
  justify-content: flex-start;
}

.message.is-assistant .bubble {
  width: min(720px, 100%) !important;
  max-width: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.message.is-user {
  justify-content: flex-end;
}

.message.is-user .bubble {
  justify-self: auto !important;
  width: auto !important;
  max-width: min(680px, 78%) !important;
  padding: 12px 16px !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: #f4f4f4 !important;
  box-shadow: none !important;
}

.message.is-user .message-body {
  color: #111827;
}

.message.is-user .user-message-actions {
  margin-top: 8px;
}

.message.is-user .user-message-actions button {
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: #6b7280;
  font-weight: 400;
}

.message.is-user .user-message-actions button:hover {
  color: #111827;
  background: #eeeeee;
}

.message-body,
.message-body p,
.message-meta,
.thinking-path,
.source-cards,
.artifact-cards,
.message-actions {
  min-width: 0;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

.message-meta {
  margin-top: 10px;
  color: #8a8f98;
}

.message-actions {
  margin-top: 8px;
}

.message.is-share-pair .bubble,
.message.is-share-pair:not(.is-user) .bubble,
.message.is-share-selected .bubble,
.message.is-share-selected:not(.is-user) .bubble {
  box-shadow: none;
}

.message.is-share-selected.is-user .bubble {
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.12) !important;
}

.message.is-share-selected.is-assistant .bubble {
  background: rgba(17, 24, 39, 0.035) !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
}

@media (max-width: 820px) {
  .message,
  .message.is-user,
  .message.is-assistant {
    width: 100% !important;
    margin-bottom: 22px;
  }

  .message.is-assistant .bubble {
    width: 100% !important;
  }

  .message.is-user .bubble {
    max-width: min(88%, 620px) !important;
    padding: 11px 14px !important;
    border-radius: 17px !important;
  }
}

/* GPT-like responsive topbar and combined model/mode menu. */
.topbar-left-cluster {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mobile-actions-menu,
.model-mode-menu {
  position: relative;
  display: inline-flex;
}

.topbar-bubble-button,
.model-mode-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #111827;
  cursor: pointer;
  background: #f4f4f4;
  box-shadow: none;
}

.topbar-bubble-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  gap: 5px;
  flex-direction: column;
}

.topbar-bubble-button span {
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.model-mode-trigger {
  min-height: 38px;
  max-width: min(52vw, 260px);
  border-radius: 999px;
  padding: 0 12px 0 15px;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.model-mode-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-mode-trigger svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.topbar-bubble-button:hover,
.model-mode-trigger:hover,
.topbar-bubble-button[aria-expanded="true"],
.model-mode-trigger[aria-expanded="true"] {
  background: #ececec;
}

.mobile-actions-popover,
.model-mode-popover {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 50;
  border: 1px solid rgba(17, 24, 39, 0.06);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
}

.mobile-actions-popover[hidden],
.model-mode-popover[hidden] {
  display: none;
}

.mobile-actions-popover {
  width: 180px;
  padding: 10px;
}

.mobile-actions-popover a,
.mobile-actions-popover button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 0 12px;
  color: #111827;
  cursor: pointer;
  background: transparent;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
}

.mobile-actions-popover a:hover,
.mobile-actions-popover button:hover {
  background: #f4f4f4;
}

.model-mode-popover {
  width: 304px;
  padding: 22px 26px;
}

.model-mode-section-title {
  margin-bottom: 18px;
  color: #9ca3af;
  font-size: 15px;
  font-weight: 500;
}

.mode-choice-list {
  display: grid;
  gap: 2px;
}

.mode-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 0;
  color: #111827;
  cursor: pointer;
  background: transparent;
  text-align: left;
  font-size: 16px;
  font-weight: 520;
}

.mode-choice:hover {
  background: #f7f7f7;
  padding-inline: 10px;
}

.mode-choice strong {
  visibility: hidden;
  color: #111827;
  font-size: 24px;
  line-height: 1;
}

.mode-choice.is-active strong {
  visibility: visible;
}

.model-choice-row {
  margin-top: 14px;
  border-top: 1px solid #eeeeee;
  padding-top: 18px;
}

.model-mode-popover .select-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
}

.model-mode-popover .model-select {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 0 8px;
  background: #f7f7f7;
  font-size: 15px;
  font-weight: 500;
}

@media (min-width: 821px) {
  .model-mode-trigger {
    min-height: 36px;
    padding: 0 11px 0 14px;
    font-size: 14px;
    font-weight: 500;
  }
}

.topbar-mode-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.chat-topbar {
  justify-content: space-between;
}

.back-link {
  margin-left: auto;
}

@media (min-width: 821px) {
  .mobile-actions-menu {
    display: none;
  }

  .chat-topbar {
    padding-inline: 22px;
  }

  .model-mode-popover {
    width: 320px;
  }
}

@media (max-width: 820px) {
  .chat-topbar {
    min-height: 70px;
    padding: 12px max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
    border-bottom: 0;
    background: #ffffff;
    backdrop-filter: none;
    overflow: visible;
    z-index: 55;
  }

  .topbar-left-cluster {
    gap: 10px;
    min-width: 0;
    z-index: 56;
  }

  .topbar-controls,
  .back-link {
    display: none !important;
  }

  .model-mode-trigger {
    max-width: calc(100vw - 104px);
    min-height: 44px;
    padding: 0 12px 0 16px;
    font-size: 14px;
    font-weight: 450;
    letter-spacing: 0;
  }

  .topbar-bubble-button {
    width: 48px;
    height: 48px;
  }

  .mobile-actions-popover,
  .model-mode-popover {
    position: fixed;
    top: calc(58px + env(safe-area-inset-top));
    z-index: 70;
  }

  .mobile-actions-popover {
    left: max(14px, env(safe-area-inset-left));
  }

  .model-mode-popover {
    left: calc(max(14px, env(safe-area-inset-left)) + 58px);
    width: min(304px, calc(100vw - 72px));
    padding: 18px 22px;
    border-radius: 24px;
  }

  .model-mode-section-title {
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 400;
  }

  .mode-choice {
    min-height: 42px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 450;
  }

  .mode-choice strong {
    font-size: 21px;
    font-weight: 500;
  }

  .model-choice-row {
    margin-top: 10px;
    padding-top: 14px;
  }

  .model-mode-popover .select-wrap {
    gap: 6px;
    font-size: 12px;
    font-weight: 400;
  }

  .model-mode-popover .model-select {
    height: 40px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 450;
  }
}

@media (max-width: 820px) {
  body,
  .chat-shell,
  .chat-main,
  .messages,
  .chat-topbar,
  .composer-wrap {
    background: #ffffff !important;
  }

  .chat-topbar {
    backdrop-filter: none !important;
    box-shadow: none !important;
  }

  .composer-wrap {
    background-image: none !important;
    box-shadow: none !important;
  }
}

@media (max-width: 820px) {
  .chat-sidebar {
    box-shadow: none !important;
  }

  body.is-sidebar-open .chat-sidebar {
    box-shadow: 10px 0 26px rgba(15, 23, 42, 0.1) !important;
  }

  .sidebar-backdrop {
    background: rgba(17, 24, 39, 0.18) !important;
  }

  .topbar-left-cluster {
    background: #ffffff !important;
  }

  .topbar-bubble-button,
  .model-mode-trigger {
    background: #ffffff !important;
    border: 1px solid #f1f1f1 !important;
    box-shadow: none !important;
  }

  .topbar-bubble-button:hover,
  .model-mode-trigger:hover,
  .topbar-bubble-button[aria-expanded="true"],
  .model-mode-trigger[aria-expanded="true"] {
    background: #fafafa !important;
  }
}

