:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --surface: #19191a;
  --surface-2: #262628;
  --surface-3: #151516;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2f2f33;
  --accent: #10a37f;
  --accent-2: #66d7bd;
  --user: #2d2d30;
  --assistant: transparent;
  --assistant-line: transparent;
  --code-bg: #0d0d0f;
  --code-text: #e8e8e8;
  --danger: #ff6b6b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --surface-3: #f8f8f8;
  --text: #171717;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --accent: #0f8f70;
  --accent-2: #09785d;
  --user: #ececea;
  --assistant: transparent;
  --assistant-line: transparent;
  --code-bg: #111214;
  --code-text: #f3f3f3;
  --danger: #c03333;
}

* {
  box-sizing: border-box;
}
.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.markdown-table th,
.markdown-table td {
  border: 1px solid rgba(128, 128, 128, 0.35);
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
}

.markdown-table th {
  font-weight: 700;
  background: rgba(128, 128, 128, 0.12);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar-overlay {
  display: none;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface-3);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

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

.mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 750;
}

.sidebar-close {
  display: none;
}

.theme-toggle {
  display: grid;
  grid-template-columns: auto 44px auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.theme-toggle input {
  appearance: none;
  width: 44px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
}

.theme-toggle input::before {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  left: 3px;
  top: 2px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 160ms ease;
}

.theme-toggle input:checked::before {
  transform: translateX(19px);
}

.mobile-menu {
  display: none;
}

h1, h2, p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.primary-btn,
.confirm-btn,
.mini-btn,
.icon-btn,
.submit-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.primary-btn {
  padding: 10px 12px;
  text-align: left;
}

.primary-btn:hover,
.confirm-btn:hover,
.mini-btn:hover,
.icon-btn:hover {
  border-color: color-mix(in srgb, var(--text) 24%, var(--line));
  background: var(--surface-2);
  color: var(--text);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.panel h2,
.history-head h2 {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
}

.panel h2 {
  margin-bottom: 10px;
}

.collapse-panel {
  flex: 0 0 auto;
}

.collapse-panel summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  user-select: none;
}

.collapse-panel summary::-webkit-details-marker {
  display: none;
}

.collapse-panel summary::after {
  content: "+";
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}

.collapse-panel[open] summary {
  margin-bottom: 10px;
}

.collapse-panel[open] summary::after {
  content: "-";
}

.history-panel {
  min-height: 180px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

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

.conversation-list {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
  scroll-behavior: smooth;
}

.conversation-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 2px;
}

.conversation-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 8px;
  text-align: left;
}

.conversation-item:hover {
  background: var(--surface);
}

.conversation-item.active {
  background: var(--surface-2);
  border-color: var(--line);
}

.conversation-open {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  padding: 5px 4px 5px 6px;
}

.conversation-title {
  min-width: 0;
  overflow: hidden;
}

.conversation-title strong,
.conversation-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-title strong {
  font-size: 13px;
  font-weight: 560;
}

.conversation-title span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0.72;
}

.conversation-item:hover .conversation-actions,
.conversation-item.active .conversation-actions {
  opacity: 1;
}

.action-btn,
.pin-btn {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #8d8d8d;
  cursor: pointer;
}

.pin-btn:hover,
.pin-btn.pinned,
.action-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.danger-action:hover {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface-2));
  color: var(--danger);
}

.action-btn svg,
.pin-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 32px 7px 10px;
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.toggle-row input {
  width: auto;
}

.endpoint {
  display: block;
  padding: 8px;
  margin-top: 8px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
}

.doc-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-2);
  font-size: 13px;
  text-decoration: none;
}

.memory-list {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.token-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: -2px 0 8px;
}

.token-actions .primary-btn {
  padding: 8px;
  text-align: center;
}

.token-status {
  min-height: 16px;
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.token-status[data-tone="ok"] {
  color: var(--accent);
}

.token-status[data-tone="warn"] {
  color: #b45309;
}

.memory-note {
  margin: 0 0 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.memory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  gap: 6px;
  align-items: start;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  font-size: 12px;
  line-height: 1.35;
}

.memory-item button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.memory-item button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.memory-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 6px;
  margin-top: 8px;
}

.memory-add input {
  margin: 0;
}

.memory-add .primary-btn {
  padding: 8px;
  text-align: center;
}

.chat-main {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.46);
}

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

.modal-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 18px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.modal-card h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.modal-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.modal-input {
  margin-top: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions .primary-btn,
.modal-actions .confirm-btn {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  font-weight: 650;
}

.confirm-btn {
  border-radius: 999px;
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
  font-weight: 650;
  min-width: 92px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.confirm-btn:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--text) 92%, var(--surface));
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.18);
}

.confirm-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  padding: 32px 28px 44px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scroll-padding-bottom: 42px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text) 22%, transparent) transparent;
}

.messages::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 22%, transparent);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.welcome {
  max-width: 680px;
  margin: 18vh auto 0;
  text-align: center;
  color: var(--muted);
}

.welcome h2 {
  color: var(--text);
  font-size: 30px;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.message {
  max-width: 920px;
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.message.user .avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.user .bubble {
  grid-column: 1;
  justify-self: end;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: #f4f4f4;
  font-size: 12px;
}

.message.assistant .avatar {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  color: #ffffff;
}

.bubble {
  min-width: 0;
  line-height: 1.66;
  border: 0;
  background: var(--surface);
  padding: 12px 15px;
  border-radius: 20px;
  box-shadow: none;
  max-width: 820px;
}

.message.assistant .bubble {
  background: transparent;
  max-width: 860px;
  padding: 3px 0 0;
  border-radius: 0;
}

.message.user .bubble {
  max-width: min(720px, 82%);
  background: var(--user);
}

.speaker {
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 560;
}

.message.assistant .speaker {
  color: var(--muted);
}

.message.user .speaker {
  text-align: right;
}

.pending-upload .bubble {
  width: min(520px, 88%);
}

.attachment-waiting-note {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.pending-attachment-list {
  display: grid;
  gap: 8px;
}

.pending-attachment {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.pending-attachment-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 15px;
}

.pending-attachment-main {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.pending-attachment-main strong,
.pending-attachment-main small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-attachment-main strong {
  font-size: 13px;
  font-weight: 650;
}

.pending-attachment-main small {
  color: var(--muted);
  font-size: 11px;
}

.pending-attachment button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.pending-attachment button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.bubble p {
  margin: 0 0 13px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble h1,
.bubble h2,
.bubble h3 {
  margin: 16px 0 8px 0;
  line-height: 1.3;
  font-weight: 600;
}

.bubble h1 {
  font-size: 1.35em;
  margin-top: 20px;
}

.bubble h2 {
  font-size: 1.2em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.bubble h3 {
  font-size: 1.08em;
}

.bubble strong {
  font-weight: 600;
}

.bubble em {
  font-style: italic;
}

.bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.92em;
  word-break: break-word;
}

.bubble thead th {
  background: var(--surface-2);
  font-weight: 600;
  text-align: left;
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.bubble tbody td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  vertical-align: top;
}

.bubble tbody tr:nth-child(even) {
  background: var(--surface-2);
}

.bubble code {
  font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.bubble a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.streaming-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.66;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 7px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.mini-btn {
  padding: 5px;
  font-size: 12px;
  background: transparent;
}

.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
}

.code-block {
  margin: 12px 0;
  overflow: hidden;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid #2c2c2c;
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 9px;
  border-bottom: 1px solid #2c2c2c;
  color: #9da7b1;
  font-size: 12px;
  background: #151515;
}

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

.code-actions button {
  border: 0;
  background: transparent;
  color: var(--code-text);
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
}

.code-actions button:hover {
  background: #2a2a2a;
}

.icon-mini {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
}

.icon-mini svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.docs {
  max-width: 920px;
  margin: 0 auto;
  padding: 42px 22px 80px;
}

.docs h1 {
  font-size: 32px;
  margin-bottom: 10px;
}

.docs h2 {
  margin-top: 28px;
  margin-bottom: 10px;
  font-size: 18px;
}

.docs pre {
  border-radius: 8px;
  background: var(--code-bg);
}

pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: var(--code-text);
  font-size: 13px;
}

.composer {
  position: relative;
  z-index: 5;
  width: 100%;
  padding: 14px 28px 24px;
  background: linear-gradient(to top, var(--bg) 82%, color-mix(in srgb, var(--bg) 84%, transparent) 94%, transparent);
}

.skill-row {
  max-width: 920px;
  margin: 0 auto;
  display: none;
  justify-content: flex-start;
}

.skill-select {
  display: none;
  width: min(430px, 100%);
  margin: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.skill-select span {
  font-weight: 650;
  text-transform: uppercase;
}

.skill-select select {
  min-height: 34px;
  font-size: 12px;
}

.composer-row {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: end;
  border: 1px solid color-mix(in srgb, var(--text) 18%, var(--line));
  background: var(--surface);
  border-radius: 24px;
  padding: 8px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.24);
}

.composer-row:focus-within {
  border-color: color-mix(in srgb, var(--text) 32%, var(--line));
}

#promptInput {
  width: 100%;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  font: inherit;
  line-height: 1.48;
  background: transparent;
  color: var(--text);
  padding: 8px 2px;
}

#promptInput:disabled {
  opacity: 0.68;
  cursor: wait;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 20px;
  border-radius: 999px;
  background: transparent;
}

.icon-btn input {
  display: none;
}

.submit-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: grid;
  place-items: center;
}

.submit-btn-core {
  width: 36px;
  height: 36px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease, background-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.submit-btn svg {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}

.submit-btn:hover .submit-btn-core {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--text) 92%, var(--surface));
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
}

.submit-btn:active .submit-btn-core {
  transform: translateY(0) scale(0.97);
}

.submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.submit-btn:disabled .submit-btn-core {
  transform: none;
  background: color-mix(in srgb, var(--text) 38%, var(--surface-2));
  box-shadow: none;
}

.attachment-tray {
  max-width: 920px;
  margin: 0 auto 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(100%, 360px);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.chip-tool {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.chip-tool:hover {
  background: var(--surface-2);
  color: var(--text);
}

.chip-tool svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: 100vw;
    height: 100dvh;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(88vw, 326px);
    max-width: 100vw;
    padding: 14px;
    display: flex;
    transform: translateX(-104%);
    transition: transform 180ms ease;
    box-shadow: 22px 0 60px rgba(0, 0, 0, 0.35);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close {
    margin-left: auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
  }

  .mobile-menu {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    left: calc(10px + env(safe-area-inset-left));
    z-index: 15;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22);
    cursor: pointer;
  }

  .mobile-menu span {
    width: 16px;
    height: 2px;
    display: block;
    background: currentColor;
    border-radius: 999px;
  }

  .composer {
    width: 100%;
    padding: 10px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: linear-gradient(to top, var(--bg) 82%, color-mix(in srgb, var(--bg) 80%, transparent) 92%, transparent);
  }

  .attachment-tray {
    max-width: none;
    width: 100%;
    margin-bottom: 7px;
    padding: 0 2px;
  }

  .skill-row {
    max-width: none;
    width: 100%;
    margin-bottom: 6px;
  }

  .skill-select {
    width: 100%;
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .skill-select select {
    min-width: 0;
  }

  .composer-row {
    width: 100%;
    max-width: none;
    grid-template-columns: 34px minmax(0, 1fr) 38px;
    gap: 6px;
    align-items: end;
    border-radius: 22px;
    padding: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  }

  .chat-main {
    height: 100dvh;
    overflow: hidden;
  }

  .messages {
    width: 100%;
    min-width: 0;
    padding: calc(60px + env(safe-area-inset-top)) 10px 34px;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scroll-padding-bottom: 34px;
  }

  .message {
    max-width: 100%;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 15px;
  }

  .message.user {
    grid-template-columns: minmax(0, 1fr) 28px;
  }

  .avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .bubble,
  .message.assistant .bubble {
    min-width: 0;
    max-width: 100%;
  }

  .message.user .bubble {
    max-width: min(88%, 680px);
  }

  .bubble {
    padding: 10px 12px;
    border-radius: 16px;
  }

  .message.assistant .bubble {
    padding-top: 1px;
  }

  #promptInput {
    min-height: 36px;
    max-height: 136px;
    padding: 8px 0;
    line-height: 1.42;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
    align-self: end;
  }

  .submit-btn {
    width: 36px;
    height: 36px;
    align-self: end;
  }

  .submit-btn-core {
    width: 34px;
    height: 34px;
  }

  .submit-btn svg {
    width: 18px;
    height: 18px;
  }

  pre {
    font-size: 12px;
  }

  .code-block {
    border-radius: 9px;
  }
}
