:root {
  color-scheme: dark;
  --bg: #0d141a;
  --panel: #111d27;
  --panel-2: #1a2733;
  --line: #283847;
  --text: #f2f6f8;
  --muted: #8d9aa6;
  --blue: #2aabee;
  --green: #37c77f;
  --bubble: #182533;
  --mine: #2b5278;
  --danger: #f06c62;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.34);
  --scrollbar-thumb: rgba(141, 154, 166, 0.34);
  --scrollbar-thumb-active: rgba(141, 154, 166, 0.54);
  --editor-bg: #1e1e1e;
  --editor-gutter: #171b20;
  --editor-line: #30363d;
  --editor-muted: #858e99;
  --editor-active: rgba(42, 171, 238, 0.13);
  --sidebar-width: 360px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e7edf3;
  --panel: #ffffff;
  --panel-2: #f4f7fa;
  --line: #d8e0e7;
  --text: #101820;
  --muted: #6b7785;
  --bubble: #ffffff;
  --mine: #d7f8c6;
  --danger: #d94f45;
  --shadow: 0 14px 40px rgba(20, 38, 54, 0.16);
  --scrollbar-thumb: rgba(91, 105, 119, 0.36);
  --scrollbar-thumb-active: rgba(91, 105, 119, 0.56);
  --editor-bg: #f8fafc;
  --editor-gutter: #eef3f7;
  --editor-line: #d8e0e7;
  --editor-muted: #7f8b96;
  --editor-active: rgba(42, 171, 238, 0.10);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  min-height: 40px;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
  background-color: var(--scrollbar-thumb);
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-active);
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(300px, var(--sidebar-width)) 1fr;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.side-header,
.chat-header {
  min-height: 60px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
}

.side-header {
  justify-content: space-between;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.05;
}

h2 {
  font-size: 16px;
}

p,
.meta {
  color: var(--muted);
  font-size: 14px;
}

.icon-button,
.button,
.pill-button {
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button .solid,
.icon-button circle {
  fill: currentColor;
  stroke: none;
}

.icon-button:hover,
.button:hover {
  background: rgba(51, 174, 244, 0.12);
}

.icon-button.stop {
  color: #ef4444;
  font-size: 14px;
}

.icon-button.stop:hover {
  background: rgba(239, 68, 68, 0.12);
}

.icon-button:disabled,
.button:disabled {
  cursor: default;
  opacity: 0.45;
}

.icon-button:disabled:hover,
.button:disabled:hover {
  background: transparent;
}

.button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--panel-2);
  font-weight: 700;
}

.pill-button {
  min-height: 34px;
  max-width: 130px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.button.primary {
  color: white;
  background: var(--blue);
}

.button.ghost {
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.search-meta {
  min-height: 24px;
  padding: 0 14px 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid transparent;
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  outline: none;
  padding: 9px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(51, 174, 244, 0.65);
}

.new-panel {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hidden {
  display: none !important;
}

.session-list {
  overflow: auto;
  scrollbar-width: thin;
  flex: 1;
}

.workspace-group {
  border-bottom: 1px solid var(--line);
}

.workspace-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 8px;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 50%);
}

.workspace-header:hover {
  background: color-mix(in srgb, var(--blue), transparent 92%);
}

.workspace-toggle {
  width: 18px;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

.workspace-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-count {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue), transparent 82%);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.session-item {
  display: flex;
  gap: 10px;
  min-height: 52px;
  padding: 7px 12px 7px 38px;
  cursor: pointer;
}

.session-item:hover,
.session-item.active {
  background: color-mix(in srgb, var(--blue), transparent 84%);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: white;
  font-weight: 800;
  flex: 0 0 auto;
}

.session-main {
  min-width: 0;
  flex: 1;
}

.session-title {
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-path,
.session-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--muted);
  margin-right: 6px;
}

.status-running {
  background: var(--green);
}

.detail {
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.empty-state {
  margin: auto;
  max-width: 460px;
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 10px;
  padding: 32px;
}

.empty-state.compact {
  margin: 12px;
  padding: 18px;
  max-width: none;
}

.chat-view,
.file-view {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-title-wrap {
  min-width: 0;
  flex: 1;
}

.chat-title-wrap h2,
.chat-title-wrap p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-strip {
  flex: 0 0 auto;
}

.activity-panel {
  margin: 6px 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel), transparent 8%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.activity-summary {
  width: 100%;
  min-height: 68px;
  border: 0;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.activity-toggle-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(42, 171, 238, 0.16);
  color: var(--blue);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.activity-preview {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: var(--muted);
}

.activity-preview small {
  display: -webkit-box;
  font-size: 10.5px;
  line-height: 1.32;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.activity-summary-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.activity-summary-main strong {
  color: var(--blue);
  font-size: 13px;
  line-height: 1.15;
}

.activity-summary-main em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.activity-panel.open .activity-summary {
  min-height: 38px;
  align-items: center;
}

.activity-list {
  display: grid;
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
  max-height: min(52dvh, 460px);
  overflow-y: auto;
}

.activity-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 7px;
  padding: 7px 9px;
  background: var(--panel);
}

.activity-item > span {
  width: 30px;
  height: 22px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(42, 171, 238, 0.14);
  color: var(--blue);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.activity-item div {
  min-width: 0;
}

.activity-item strong {
  display: block;
  font-size: 12px;
}

.activity-item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.activity-item time {
  color: var(--muted);
  font-size: 10px;
}

.activity-item details {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.activity-thinking {
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-2);
}

.activity-thinking p {
  font-size: 11px;
}

.thread-search-strip {
  flex: 0 0 auto;
  min-height: 46px;
  margin: 10px 14px 0;
  padding: 7px 8px 7px 13px;
  border: 1px solid rgba(42, 171, 238, 0.28);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 84%, var(--blue) 16%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.thread-search-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.thread-search-copy strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
}

.thread-search-copy span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.thread-search-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
}

.thread-search-actions .icon-button {
  width: 30px;
  height: 30px;
  font-size: 17px;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: min(760px, 82%);
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--bubble);
  line-height: 1.45;
  font-size: 15px;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.message.user {
  align-self: flex-end;
  background: var(--mine);
}

.message p {
  margin: 0 0 8px;
}

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

.message pre,
.file-preview pre {
  overflow: auto;
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  white-space: pre-wrap;
}

.message code,
.file-preview code {
  border-radius: 5px;
  padding: 1px 5px;
  background: rgba(127, 127, 127, 0.20);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.message pre code,
.file-preview pre code {
  padding: 0;
  background: transparent;
}

.message a,
.file-preview a {
  color: var(--blue);
}

.message.error {
  border: 1px solid rgba(227, 90, 84, 0.5);
}

.search-mark {
  box-shadow: 0 0 0 1px rgba(255, 212, 96, 0.14);
}

.search-mark.active {
  box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.34);
}

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

.file-pill {
  min-height: 34px;
  max-width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(42, 171, 238, 0.14);
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.file-pill:hover {
  background: rgba(42, 171, 238, 0.22);
}

.file-pill span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-pill-icon {
  flex: 0 0 auto;
  font-size: 15px;
}

.file-pill.proceed {
  background: var(--danger);
  color: white;
}

.file-pill.proceed:hover {
  filter: brightness(1.05);
}

.message-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.attachment-preview {
  padding: 8px 12px 0;
  background: var(--panel);
}

.attachment-card {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: var(--panel-2);
}

.attachment-card img,
.attachment-file-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.attachment-card img {
  display: block;
  object-fit: cover;
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  color: var(--blue);
  background: rgba(51, 174, 244, 0.14);
  font-size: 22px;
}

.attachment-card strong,
.attachment-card em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.attachment-card em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.attachment-card button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}

.attachment-card button:hover {
  color: var(--text);
  background: rgba(127, 127, 127, 0.16);
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: 40px 48px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: end;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.composer textarea {
  min-height: 42px;
  max-height: 160px;
  resize: none;
  border-radius: 999px;
  padding: 11px 16px;
  background: color-mix(in srgb, var(--panel-2), transparent 8%);
}

.more {
  border: 2px solid color-mix(in srgb, var(--blue), transparent 28%);
  background: color-mix(in srgb, var(--blue), transparent 88%);
}

.attach {
  color: var(--blue);
}

.composer-actions {
  position: absolute;
  left: 56px;
  bottom: 60px;
  z-index: 24;
  width: min(280px, calc(100vw - 90px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel), transparent 2%);
  box-shadow: var(--shadow);
}

.composer-action {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 7px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.composer-action:hover {
  background: var(--panel-2);
}

.composer-action span,
.composer-action strong {
  display: block;
}

.composer-action span {
  color: var(--muted);
  font-size: 11px;
}

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

.model-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 64px;
  z-index: 26;
  max-height: min(70dvh, 520px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel), transparent 4%);
  box-shadow: var(--shadow);
}

.model-option {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.model-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.model-option:hover,
.model-option.active {
  background: var(--panel-2);
}

.model-option strong,
.model-option span {
  display: block;
}

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

.model-check {
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
}

.send {
  color: var(--blue);
}

.file-browser,
.viewer-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.file-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.file-tab {
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  gap: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}

.file-tab span {
  font-size: 12px;
  font-weight: 700;
}

.file-tab.active,
.file-tab:hover {
  color: var(--blue);
  background: rgba(51, 174, 244, 0.14);
}

.file-toolbar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.file-toolbar input,
.viewer-search input {
  min-height: 38px;
  border-radius: 10px;
}

.file-path-bar {
  min-height: 36px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  scrollbar-width: none;
}

.file-path-bar::-webkit-scrollbar {
  display: none;
}

.file-path-bar button {
  flex: 0 0 auto;
  max-width: 220px;
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-path-bar button:hover {
  color: var(--blue);
  background: rgba(51, 174, 244, 0.12);
}

.file-path-bar span {
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--muted), transparent 35%);
}

.file-path-bar strong {
  color: var(--muted);
  font-size: 12px;
}

.file-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 10px 18px;
}

.tree-row {
  display: grid;
  grid-template-columns: 18px 24px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 6px 8px 6px calc(8px + (var(--tree-depth, 0) * 18px));
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}

.tree-row:hover,
.tree-row.active {
  background: color-mix(in srgb, var(--blue), transparent 84%);
  color: var(--text);
}

.tree-twist {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.tree-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 850;
}

.tree-name {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 750;
}

.tree-row[data-type="directory"] .tree-name {
  font-weight: 800;
}

.tree-row[data-kind="binary"] .tree-icon,
.tree-row[data-kind="large-text"] .tree-icon {
  color: var(--muted);
}

.tree-row.report-row {
  min-height: 46px;
}

.tree-row.report-row .tree-name {
  display: grid;
  gap: 2px;
}

.tree-row.report-row .tree-name strong,
.tree-row.report-row .tree-name small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-row.report-row .tree-name small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  max-width: min(58vw, 520px);
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.viewer-actions::-webkit-scrollbar {
  display: none;
}

.mini-action {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--panel-2);
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.mini-action.primary {
  color: white;
  background: var(--blue);
}

.mini-action.active,
.mini-action:hover,
.viewer-actions .icon-button:hover {
  background: rgba(51, 174, 244, 0.16);
}

.mini-action:disabled,
.viewer-actions .icon-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.viewer-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 40px 40px;
  gap: 8px;
  align-items: center;
  background: var(--panel);
}

.viewer-search span {
  color: var(--muted);
  font-size: 12px;
  min-width: 46px;
  text-align: right;
}

.viewer-save-note {
  margin: 8px 12px 0;
  border: 1px solid rgba(51, 174, 244, 0.30);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(51, 174, 244, 0.08);
  font-size: 12px;
}

.viewer-save-note.inline {
  margin: 12px;
}

.file-preview {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: var(--bg);
  line-height: 1.5;
}

.markdown-doc,
.code-doc,
.download-doc {
  max-width: 900px;
  margin: 0 auto;
  border-radius: 8px;
}

.markdown-doc {
  padding: 14px 16px;
  background: var(--bubble);
  color: var(--text);
}

.markdown-doc h3,
.markdown-doc h4,
.markdown-doc h5 {
  margin: 12px 0 8px;
}

.markdown-doc p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 10px;
  white-space: normal;
}

.markdown-doc pre,
.code-doc {
  overflow: auto;
  padding: 14px 16px;
  background: var(--editor-bg);
  color: var(--text);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.file-preview .code-doc {
  white-space: pre;
}

.code-doc.wrap,
.file-preview .code-doc.wrap,
.markdown-doc pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-doc code {
  padding: 0;
  background: transparent;
}

.file-editor-input {
  flex: 1;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 14px 16px;
  background: var(--editor-bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  resize: none;
}

.file-editor-input.wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.file-editor-input[readonly] {
  color: var(--muted);
}

.code-editor-shell {
  flex: 1;
  min-height: 0;
  margin: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--editor-line);
  border-radius: 12px;
  background: var(--editor-bg);
}

.code-editor-meta {
  flex: 0 0 auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--editor-line);
  color: var(--editor-muted);
  background: color-mix(in srgb, var(--editor-gutter), transparent 8%);
  font-size: 12px;
  font-weight: 700;
}

.code-editor-mount,
.code-editor-shell .cm-editor {
  flex: 1;
  min-height: 0;
}

.code-editor-shell .cm-editor {
  height: 100%;
  background: var(--editor-bg);
}

.code-editor-shell .cm-lineNumbers .cm-gutterElement {
  min-width: 34px;
}

.code-editor-shell .cm-panels {
  background: var(--panel);
  color: var(--text);
  border-color: var(--editor-line);
}

.code-editor-shell .cm-textfield {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}

.image-doc {
  max-width: 980px;
  margin: 0 auto;
}

.image-doc img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.download-doc {
  margin-top: 18px;
  padding: 18px;
  display: grid;
  gap: 10px;
  background: var(--bubble);
  color: var(--text);
}

mark {
  border-radius: 4px;
  padding: 0 2px;
  background: rgba(255, 212, 96, 0.34);
  color: inherit;
}

mark.active {
  background: rgba(51, 174, 244, 0.48);
}

@media (max-width: 760px) {
  .app {
    display: block;
  }

  .sidebar {
    min-height: 100vh;
  }

  .detail {
    display: none;
  }

  body.chat-open .sidebar {
    display: none;
  }

  body.chat-open .detail {
    display: flex;
  }

  .message {
    max-width: 92%;
  }

  .chat-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .pill-button {
    max-width: 104px;
  }

  h1 {
    font-size: 28px;
  }

  .composer {
    grid-template-columns: 40px 48px minmax(0, 1fr) 40px;
  }

  .composer-actions {
    left: 56px;
    width: min(280px, calc(100vw - 90px));
  }
}
