:root {
  --run: var(--accent);
}

.msg-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-top: 0;
  border: var(--border-w) solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
}
.jumbo-logo {
  display: block;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  -webkit-mask: url("../assets/logoNoBg-black.png") center / contain no-repeat;
  mask: url("../assets/logoNoBg-black.png") center / contain no-repeat;
}
.jumbo-logo-lg { width: 56px; height: 56px; }
.brand-mark .jumbo-logo { width: 26px; height: 26px; }
.empty-chat-state .jumbo-logo { margin-bottom: 2px; }
.msg-assistant.is-working > .msg-avatar { animation: avatar-pulse 1.6s ease-out infinite; }
@keyframes avatar-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 38%, transparent); }
  100% { box-shadow: 0 0 0 9px transparent; }
}

.tool-group {
  width: max-content;
  max-width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.tool-group-head {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  max-width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 400;
  text-align: left;
}
.tool-group-head:hover,.tool-group-head:focus-visible { background: transparent; color: var(--text-primary); outline: none; }
.tool-group-head[aria-expanded="true"] .tool-caret { transform: rotate(180deg); }
.tool-group-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; color: var(--text-muted); }
.tool-group-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-group.is-live .tool-group-title {
  background: linear-gradient(90deg, var(--text-muted), var(--text-primary), var(--text-muted));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.8s linear infinite;
}
@supports not (background-clip: text) {
  .tool-group.is-live .tool-group-title { background: none; color: var(--text-muted); }
}
.tool-group-list { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 17px; padding: 2px 0 2px 12px; border: 0; border-left: 2px solid var(--border); }
.tool-group-list[hidden] { display: none; }
.tool-group .tool-block { width: 100%; max-width: 100%; border-radius: var(--radius-lg); }
.tool-group .tool-block:hover { background: transparent; }
.tool-group .tool-header { width: 100%; min-height: 36px; padding: 6px 8px; }
.tool-group .tool-status { color: var(--text-muted); }
.tool-group .tool-status i { font-size: 16px; }
.tool-group .tool-body { margin: 2px 8px 8px 17px; }
.tool-header .tool-spinner { flex-shrink: 0; margin-left: auto; }
.tool-target {
  min-width: 0;
  max-width: 40%;
  overflow: hidden;
  color: var(--text-muted);
  font: 12px/1.2 "SFMono-Regular", Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-target:empty { display: none; }
.tool-block.is-interrupted { opacity: .68; }
.tool-approval-block {
  width: min(100%, 620px);
  padding: 12px 14px;
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
}
.tool-approval-block:hover { background: var(--bg-surface); }
.tool-approval-header { width: 100%; padding: 0 0 10px; }
.tool-approval-state { color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; }
.tool-approval-body { display: grid; gap: 10px; padding-left: 26px; }
.tool-approval-target { color: var(--text-secondary); font: 12px/1.45 "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.tool-approval-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.tool-approval-actions .btn { padding: 8px 16px; font-size: var(--fs-sm); }
.tool-approval-actions .text-button { margin-left: 4px; color: var(--text-muted); font-size: var(--fs-xs); }
.tool-approval-actions .text-button:hover { color: var(--text-primary); text-decoration: underline; }

.infinite-panel {
  width: min(100%, 620px);
  overflow: hidden;
  margin: 0 0 14px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
}
.infinite-heading.run-card { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 12px 10px 14px; }
.run-icon.infinite-orbit { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--r-sm); background: var(--accent-bg); color: var(--run); font-size: 18px; }
.run-copy { display: grid; flex: 1; min-width: 0; }
.run-copy strong { font-size: var(--fs-sm); }
.run-copy small { overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.run-clock { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.run-toggle { flex: 0 0 32px; width: 32px; height: 32px; padding: 0; font-size: 16px; }
.run-toggle i { transition: transform var(--dur-fast) var(--ease-out); }
.run-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.infinite-panel .infinite-progress { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 14px 12px; }
.infinite-progress-track { height: 6px; flex: 1; overflow: hidden; border-radius: var(--radius-full); background: var(--bg-hover); }
.infinite-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--run); transition: width 220ms var(--ease-out); }
.infinite-progress small { min-width: 105px; color: var(--text-muted); font-size: 11px; text-align: right; }
.infinite-todos { display: flex; flex-direction: column; gap: 2px; padding: 6px; border-top: 1px solid var(--border); }
.infinite-panel.is-collapsed .infinite-todos { display: none; }
.infinite-todo-item { padding: 0; border-radius: var(--radius-lg); transition: background var(--dur-fast) var(--ease-out); }
.infinite-todo-item.running { background: var(--accent-bg); }
.infinite-todo-row { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 8px 10px; border-radius: var(--radius-lg); text-align: left; }
.infinite-todo-row:not(:disabled):hover { background: var(--bg-hover); }
.infinite-todo-row:disabled { cursor: default; }
.infinite-todo-row[aria-expanded="true"] .tool-caret { transform: rotate(180deg); }
.infinite-todo-icon { display: grid; place-items: center; width: 18px; flex: 0 0 18px; color: var(--text-muted); font-size: 16px; }
.infinite-todo-item.running .infinite-todo-icon,
.infinite-todo-item.done .infinite-todo-icon { color: var(--run); }
.infinite-todo-item.error .infinite-todo-icon { color: var(--text-danger); }
.infinite-todo-title { flex: 1; min-width: 0; overflow: hidden; color: var(--text-primary); font-size: var(--fs-sm); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.infinite-todo-state { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.infinite-panel .infinite-todo-result { margin: 2px 10px 8px 38px; padding: 8px 12px; border-left: 2px solid var(--run); color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.5; }
.infinite-todo-result p { margin: 0 0 5px; }
.infinite-todo-result p:last-child { margin-bottom: 0; }
.infinite-panel[data-status="stopped"] .infinite-orbit,
.infinite-panel[data-status="error"] .infinite-orbit { color: var(--text-muted); background: var(--bg-hover); }

.swarm-panel {
  width: min(100%, 620px);
  margin: 0 0 14px;
  padding: 12px 14px 14px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
}
.swarm-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.swarm-heading strong { display: block; font-size: var(--fs-sm); }
.swarm-heading small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; }
.swarm-orbit { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--r-sm); background: var(--accent-bg); color: var(--accent); font-size: 18px; }
.swarm-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.swarm-tile { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; height: 44px; border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface-2); color: var(--text-secondary); font-size: var(--fs-sm); transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.swarm-tile b { font-weight: 650; font-variant-numeric: tabular-nums; }
.swarm-tile > i { font-size: 16px; }
.swarm-tile:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.swarm-tile.running { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.swarm-tile.running > i { color: var(--accent); }
.swarm-tile.done { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.swarm-tile.error { border-color: var(--text-danger); color: var(--text-danger); }
.window-plain { margin: 0; padding: 20px 24px; overflow: auto; color: var(--text-secondary); font: 13px/1.6 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.file-card { width: min(100%, 720px); overflow: hidden; border: var(--border-w) solid var(--border); border-radius: var(--radius-xl); background: var(--bg-surface); }
.file-card-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--border); background: var(--bg-surface-2); }
.file-card-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: var(--r-sm); background: var(--accent-bg); color: var(--accent); font-size: 18px; }
.file-card-name { display: grid; flex: 1; min-width: 0; }
.file-card-name strong { overflow: hidden; font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.file-card-name small { overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-card-tabs { display: inline-flex; flex-shrink: 0; gap: 2px; padding: 3px; border: var(--border-w) solid var(--border); border-radius: var(--radius-full); background: var(--bg-surface); }
.file-card-tabs button { padding: 5px 10px; border-radius: var(--radius-full); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.file-card-tabs button[aria-selected="true"] { background: var(--bg-hover); color: var(--text-primary); }
.file-card-pane[hidden] { display: none; }
.file-card .code-header { display: none; }
.file-card .code-block { margin: 0; border: 0; border-radius: 0; }
.file-card-code { max-width: none; }
.markdown-file-preview { max-width: none; padding: 18px; }
.markdown-file-preview.is-fill { min-height: 100%; }
.file-card-body.is-collapsed .markdown-file-preview { max-height: 260px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.file-card-body.is-collapsed .code-block pre { max-height: 260px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.file-card .workspace-tool-diff { max-height: 320px; border-radius: 0; }
.file-card-error { margin: 0; padding: 18px; color: var(--text-danger); font-size: var(--fs-sm); }
.file-card-more { width: 100%; padding: 9px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 600; }
.file-card-more:hover { background: var(--bg-hover); }
.changed-list-rows { display: flex; flex-direction: column; padding: 4px; }
.file-card.changed-list { width: max-content; max-width: 100%; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.changed-list .file-card-head { gap: 7px; padding: 7px 9px; border: 0; background: transparent; }
.changed-list .file-card-icon { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 0; background: transparent; color: var(--text-muted); font-size: 16px; }
.changed-list .file-card-name { display: flex; flex: 0 1 auto; align-items: baseline; gap: 9px; }
.changed-list .file-card-name strong { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 400; }
.changed-list .file-card-name small { flex: 0 0 auto; }
.changed-list .changed-list-rows { gap: 2px; margin: 2px 0 4px 17px; padding: 2px 0 2px 12px; border-left: 2px solid var(--border); }
.changed-list .changed-row { padding: 6px 8px; }
.changed-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-lg); }
.changed-row:hover { background: var(--bg-hover); }
.changed-row > i { color: var(--text-muted); font-size: 18px; }
.changed-name { flex: 1; min-width: 0; overflow: hidden; color: var(--text-primary); font: 500 12.5px/1.3 "SFMono-Regular", Consolas, monospace; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.changed-stats { font: 600 12px/1 "SFMono-Regular", Consolas, monospace; white-space: nowrap; }
.changed-btn { padding: 4px 10px; border: var(--border-w) solid var(--border); border-radius: var(--radius-full); color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.changed-btn:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.workspace-attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-user .workspace-attachments { width: 100%; justify-content: flex-end; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; width: auto; max-width: min(260px, 100%); min-width: 0; padding: 6px 10px; border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface-2); color: var(--text-secondary); }
.file-chip:not(:disabled):hover { border-color: var(--border-strong); background: var(--bg-hover); color: var(--text-primary); }
.file-chip > i { flex-shrink: 0; color: var(--accent); font-size: 18px; }
.file-chip-name { min-width: 0; overflow: hidden; color: var(--text-primary); font: 500 var(--fs-xs)/1.2 "SFMono-Regular", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.pending-file-wrap { max-width: min(300px, calc(100vw - 92px)); }
.pending-file { max-width: 100%; padding-right: 28px; cursor: pointer; }
.pending-file:disabled { cursor: wait; opacity: .72; }
.pending-file-remove { z-index: 1; }

.code-preview-overlay { position: fixed; inset: 0; z-index: 160; display: flex; align-items: center; justify-content: center; padding: 24px; background: color-mix(in srgb, #000 50%, transparent); animation: overlay-in var(--dur-base) var(--ease-out); }
.chat-window { display: flex; flex-direction: column; width: min(1100px, 100%); height: min(760px, calc(100dvh - 48px)); overflow: hidden; border: var(--border-w) solid var(--border); border-radius: var(--r-xl); background: var(--bg-surface); box-shadow: var(--shadow-md); animation: modal-in var(--dur-base) var(--ease-out); }
.chat-window-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-surface-2); }
.chat-window-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--r-sm); background: var(--accent-bg); color: var(--accent); font-size: 18px; }
.chat-window-title { display: grid; flex: 1; min-width: 0; }
.chat-window-title h2 { overflow: hidden; margin: 0; font-size: var(--fs-base); text-overflow: ellipsis; white-space: nowrap; }
.chat-window-title small { overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chat-window-head .file-card-tabs { margin-left: auto; }
.chat-window-actions { display: flex; gap: 2px; }
.chat-window-body { flex: 1; min-height: 0; overflow: auto; outline: none; }
.chat-window-body > .assistant-markdown,
.chat-window-body > .window-plain { max-width: none; padding: 20px 24px; }
.window-code .code-header { display: none; }
.window-code { max-width: none; min-height: 100%; }
.window-code .code-block { margin: 0; border: 0; border-radius: 0; }
.window-code .code-block pre { max-height: none; }
.chat-window-body > .markdown-file-preview.is-fill { min-height: 100%; }
.window-loading, .preview-note { padding: 24px; color: var(--text-muted); text-align: center; }
.preview-wrap { display: flex; flex-direction: column; background: var(--bg-surface-2); }
.preview-wrap.is-fill { height: 100%; }
.preview-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.preview-bar button { padding: 4px 10px; border-radius: var(--radius-full); color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.preview-bar button:hover, .preview-bar button[aria-pressed="true"] { background: var(--bg-hover); color: var(--text-primary); }
.preview-bar [data-reload] { margin-left: auto; }
.file-card-preview { display: block; width: 100%; max-width: 100%; margin: 0 auto; border: 0; background: #fff; }
.preview-wrap:not(.is-fill) .file-card-preview { resize: vertical; }
.preview-wrap.is-fill .file-card-preview { flex: 1; min-height: 0; }
.preview-error { padding: 8px 12px; background: color-mix(in srgb, var(--text-danger) 10%, var(--bg-surface)); color: var(--text-danger); font-size: var(--fs-xs); }
.code-preview-btn { margin-left: auto; }

.chat-window .file-card-tabs button { min-height: 28px; }
.code-preview-overlay .icon-btn { flex: 0 0 34px; width: 34px; height: 34px; padding: 0; }

.chat-bar .infinite-controls { width: auto; margin-left: 0; padding: 0; border: 0; gap: 0; }
.chat-bar .infinite-controls-label { display: none; }
.chat-bar #infiniteControls .app-select-trigger {
  width: max-content;
  min-width: 0;
  min-height: 0;
  padding: 6px 10px 6px 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
#infiniteControls .app-select-trigger:hover { border-color: var(--border-strong); background: var(--bg-hover); }
#infiniteControls .app-select-value::before { color: var(--text-muted); content: "Run for "; font-weight: 500; }

@media (max-width: 700px) {
  .infinite-panel .infinite-progress { align-items: flex-start; flex-direction: column; gap: 5px; }
  .infinite-panel .infinite-progress small { width: 100%; text-align: left; }
  .swarm-grid { gap: 5px; }
  .swarm-tile { height: 42px; gap: 4px; font-size: var(--fs-xs); }
  .chat-window-head { flex-wrap: wrap; padding: 10px 12px; }
  .chat-window-title { min-width: calc(100% - 120px); }
  .chat-window-head .file-card-tabs { order: 5; flex: 1 1 100%; width: 100%; margin: 0; justify-content: center; }
  .chat-window-head .file-card-tabs button { flex: 1; }
  .file-card-head { flex-wrap: wrap; }
  .file-card-name { flex: 1; }
  .file-card-head > .file-card-tabs { order: 5; flex: 1 1 100%; justify-content: center; }
  .file-card-head > .file-card-tabs button { flex: 1; }
  .changed-row { gap: 6px; }
  .changed-stats { font-size: 11px; }
  .changed-btn { padding: 4px 7px; }
}
@media (max-width: 560px) {
  .msg { gap: 8px; }
  .msg-avatar { flex-basis: 26px; width: 26px; height: 26px; border-radius: 8px; }
  .msg-avatar .jumbo-logo { width: 16px; height: 16px; }
  .code-preview-overlay { padding: 0; }
  .chat-window { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .chat-window-body > .assistant-markdown,
  .chat-window-body > .window-plain { padding: 16px; }
}
