/* Que workspace v4 — conversation-first task workbench.
 * This file intentionally loads after the legacy stylesheet so the redesign
 * can be reviewed and rolled back without mutating several generations of CSS.
 */

:root {
  --q-bg: #f7f7f6;
  --q-panel: #ffffff;
  --q-panel-soft: #f5f6f7;
  --q-panel-hover: #eef1f4;
  --q-ink: #202124;
  --q-muted: #6d7178;
  --q-faint: #9ca1a8;
  --q-line: #e3e5e8;
  --q-line-strong: #cfd3d8;
  --q-blue: #3478f6;
  --q-blue-strong: #1f63db;
  --q-blue-soft: #edf4ff;
  --q-green: #25875a;
  --q-green-soft: #eaf6ef;
  --q-amber: #a8670c;
  --q-amber-soft: #fff5df;
  --q-red: #c33e38;
  --q-red-soft: #fff0ef;
  --q-code: #17191d;
  --q-code-ink: #e8eaed;
  --q-sidebar: 276px;
  --q-inspector: 560px;
  --q-topbar: 56px;
  --q-composer-max: 820px;
  --q-thread-max: 800px;
  --q-shadow-soft: 0 1px 2px rgba(25, 28, 33, .04), 0 10px 34px rgba(25, 28, 33, .06);
  --q-shadow-float: 0 16px 48px rgba(25, 28, 33, .13);
  --accent: var(--q-blue);
  --accent-strong: var(--q-blue-strong);
  --accent-soft: var(--q-blue-soft);
  --ink: var(--q-ink);
  --muted: var(--q-muted);
  --muted-2: var(--q-faint);
  --line: var(--q-line);
  --line-strong: var(--q-line-strong);
  --ok: var(--q-green);
  --ok-soft: var(--q-green-soft);
  --warn: var(--q-amber);
  --warn-soft: var(--q-amber-soft);
  --err: var(--q-red);
  --err-soft: var(--q-red-soft);
}

html,
body {
  color: var(--q-ink);
  background: var(--q-bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

button,
[role="button"],
summary,
input,
textarea,
select,
[tabindex] {
  -webkit-tap-highlight-color: transparent;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid rgba(52, 120, 246, .28) !important;
  outline-offset: 2px;
}

button {
  border-radius: 9px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn,
.icon-btn,
.tool-command,
.composer-file-action,
.composer-stop-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--q-line);
  color: var(--q-ink);
  background: var(--q-panel);
  box-shadow: none;
}

.btn:hover,
.icon-btn:hover,
.tool-command:hover,
.composer-file-action:hover,
.composer-stop-action:hover {
  border-color: var(--q-line-strong);
  color: var(--q-ink);
  background: var(--q-panel-hover);
}

.btn.primary {
  border-color: var(--q-blue);
  color: #fff;
  background: var(--q-blue);
}

.btn.primary:hover {
  border-color: var(--q-blue-strong);
  background: var(--q-blue-strong);
}

.btn.danger {
  border-color: #f0c7c4;
  color: var(--q-red);
  background: var(--q-red-soft);
}

.btn.quiet,
.icon-btn.quiet {
  border-color: transparent;
  background: transparent;
}

.btn.small {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13px;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
}

.link-button {
  min-height: 32px;
  padding: 4px 7px;
  border: 0;
  color: var(--q-blue);
  background: transparent;
  font-size: 13px;
}

.link-button:hover {
  border: 0;
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

/* Shell */

#app.que-shell {
  --inspector-width: var(--q-inspector);
  display: grid;
  width: 100vw;
  height: 100dvh;
  min-width: 0;
  grid-template-columns: var(--q-sidebar) minmax(0, 1fr) 0;
  grid-template-rows: var(--q-topbar) minmax(0, 1fr);
  overflow: hidden;
  background: var(--q-panel);
}

#app.que-shell.inspector-open {
  grid-template-columns: var(--q-sidebar) minmax(420px, 1fr) minmax(420px, var(--inspector-width));
}

#layout {
  display: contents;
}

#topbar {
  position: static;
  z-index: 20;
  display: flex;
  width: auto;
  min-width: 0;
  height: var(--q-topbar);
  min-height: var(--q-topbar);
  grid-column: 2 / 4;
  grid-row: 1;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 14px 0 22px;
  border: 0;
  border-bottom: 1px solid var(--q-line);
  background: rgba(255, 255, 255, .96);
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.topbar-context {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-breadcrumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--q-muted);
  font-size: 13px;
}

.topbar-breadcrumbs .tb-item {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tb-run-title {
  color: var(--q-ink);
  font-weight: 620;
}

.tb-sep {
  color: var(--q-faint);
}

.topbar-runmeta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--q-muted);
  font-size: 12px;
}

.badge-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--q-muted);
  background: var(--q-panel-soft);
  font-size: 12px;
  font-weight: 620;
}

.badge-status.st-RUNNING,
.badge-status.st-STARTING,
.badge-status.st-QUEUED {
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

.badge-status.st-WAITING_APPROVAL,
.badge-status.st-WAITING_INPUT {
  color: var(--q-amber);
  background: var(--q-amber-soft);
}

.badge-status.st-COMPLETED {
  color: var(--q-green);
  background: var(--q-green-soft);
}

.badge-status.st-FAILED,
.badge-status.st-CANCELLED {
  color: var(--q-red);
  background: var(--q-red-soft);
}

.tb-thinking {
  color: var(--q-blue-strong);
}

/* Sidebar */

#sidebar {
  position: static;
  z-index: 30;
  display: flex;
  width: auto;
  min-width: 0;
  height: 100dvh;
  grid-column: 1;
  grid-row: 1 / 3;
  flex-direction: column;
  gap: 0;
  padding: 14px 12px 10px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--q-line);
  color: var(--q-ink);
  background: #f4f4f3;
  box-shadow: none;
}

.sidebar-brand {
  display: flex;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
}

.brand-lockup {
  gap: 10px;
  color: var(--q-ink);
  font-size: 16px;
  font-weight: 720;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #fff;
  background: var(--q-ink);
  box-shadow: none;
  font-size: 14px;
}

#btn-new-task.btn.command {
  justify-content: flex-start;
  min-height: 44px;
  margin: 10px 0 10px;
  padding: 9px 12px;
  border: 1px solid var(--q-line-strong);
  border-radius: 10px;
  color: var(--q-ink);
  background: var(--q-panel);
  box-shadow: 0 1px 2px rgba(20, 22, 27, .04);
  font-size: 14px;
  font-weight: 620;
}

#btn-new-task.btn.command:hover {
  border-color: #b9bec5;
  color: var(--q-ink);
  background: #fafafa;
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 0 12px;
  color: var(--q-faint);
}

.sidebar-search .icon {
  position: absolute;
  left: 11px;
  z-index: 1;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

#task-search {
  height: 38px;
  min-height: 38px;
  padding: 8px 10px 8px 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--q-ink);
  background: #eaeaE8;
  font-size: 13px;
}

#task-search:focus {
  border-color: var(--q-line-strong);
  background: var(--q-panel);
  outline: none;
}

.sidebar-scroll {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.side-section {
  margin: 0 0 14px;
}

.side-section-head {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  color: var(--q-muted);
}

.side-h {
  margin: 0;
  color: var(--q-muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .02em;
}

.side-count {
  min-width: 20px;
  color: var(--q-faint);
  font-size: 12px;
  text-align: right;
}

.side-add {
  display: inline-flex;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--q-muted);
  background: transparent;
}

.side-add:hover {
  border: 0;
  color: var(--q-ink);
  background: #e5e6e5;
}

.side-add .icon {
  width: 16px;
  height: 16px;
}

.ws-item,
.run-item,
.sess-item {
  position: relative;
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  margin: 2px 0;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--q-ink);
  background: transparent;
  cursor: pointer;
}

.ws-item:hover,
.run-item:hover,
.sess-item:hover {
  border-color: transparent;
  background: #e8e8e7;
}

.ws-item.active,
.run-item.active,
.sess-item.active {
  border-color: #d8dade;
  background: var(--q-panel);
  box-shadow: 0 1px 2px rgba(20, 22, 27, .04);
}

.ws-item .grow,
.sess-item .grow {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-item > .mini,
.sess-item > .mini {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--q-muted);
  background: transparent;
  opacity: 0;
}

.ws-item:hover > .mini,
.ws-item:focus-within > .mini,
.sess-item:hover > .mini,
.sess-item:focus-within > .mini,
.ws-item.active > .mini,
.sess-item.active > .mini {
  opacity: 1;
}

.ws-item > .mini:hover,
.sess-item > .mini:hover {
  color: var(--q-ink);
  background: #dfe1e3;
}

.run-item {
  align-items: flex-start;
  padding-block: 8px;
}

.r-ico {
  width: 9px;
  height: 9px;
  flex: none;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 50%;
  color: transparent;
  background: var(--q-faint);
  font-size: 0;
}

.r-ico.ico-RUNNING,
.r-ico.ico-STARTING,
.r-ico.ico-QUEUED {
  background: var(--q-blue);
}

.r-ico.ico-WAITING_APPROVAL,
.r-ico.ico-WAITING_INPUT {
  background: var(--q-amber);
}

.r-ico.ico-COMPLETED {
  background: var(--q-green);
}

.r-ico.ico-FAILED,
.r-ico.ico-CANCELLED {
  background: var(--q-red);
}

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

.r-title {
  display: block;
  overflow: hidden;
  color: var(--q-ink);
  font-size: 13px;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.r-time {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--q-faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-empty {
  padding: 9px;
  color: var(--q-faint);
  font-size: 12px;
}

.sidebar-advanced {
  margin: 4px 2px 12px;
  border-top: 1px solid var(--q-line);
}

.sidebar-advanced > summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 7px;
  border-radius: 8px;
  color: var(--q-muted);
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
}

.sidebar-advanced > summary > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-advanced > summary::-webkit-details-marker {
  display: none;
}

.sidebar-advanced > summary:hover {
  background: #e9e9e8;
}

.sidebar-advanced .summary-chevron {
  width: 15px;
  height: 15px;
  transition: transform .16s ease;
}

.sidebar-advanced[open] .summary-chevron {
  transform: rotate(180deg);
}

.sidebar-explainer {
  margin: 0 7px 8px;
  color: var(--q-faint);
  font-size: 11.5px;
  line-height: 1.45;
}

.row-gap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
}

.usage {
  flex: none;
  margin: 4px 6px 8px;
  padding: 8px 0;
  color: var(--q-muted);
  background: transparent;
}

.usage-label {
  font-size: 11.5px;
}

.usage-bar {
  height: 4px;
  margin: 6px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #dedfdf;
}

#usage-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--q-blue);
}

#usage-fill.hot {
  background: var(--q-amber);
}

#usage-text {
  font-size: 10.5px;
}

.sidebar-account {
  display: flex;
  min-height: 48px;
  flex: none;
  align-items: center;
  gap: 4px;
  padding: 6px 4px 0;
  border-top: 1px solid var(--q-line);
}

.user-cluster {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 9px;
}

.user-avatar {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: #8b66bd;
}

.user-avatar .icon {
  width: 16px;
  height: 16px;
}

#user-label {
  min-width: 0;
  overflow: hidden;
  color: var(--q-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Conversation */

#center {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  height: auto;
  grid-column: 2;
  grid-row: 2;
  grid-template-rows: 48px auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 0;
  background: var(--q-panel);
}

.thread-toolbar {
  display: flex;
  width: 100%;
  height: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid #f0f1f2;
  background: rgba(255, 255, 255, .92);
}

.thread-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.thread-identity > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.thread-identity strong {
  font-size: 14px;
  font-weight: 670;
}

.thread-identity span:not(.agent-orbit) {
  color: var(--q-faint);
  font-size: 11.5px;
}

.agent-orbit {
  position: relative;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--q-line-strong);
  border-radius: 50%;
}

.agent-orbit i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--q-blue);
}

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

.workspace-signal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--q-muted);
  font-size: 11.5px;
}

.workspace-signal i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--q-green);
}

#sticky-slot {
  z-index: 5;
  width: min(var(--q-thread-max), calc(100% - 40px));
  margin: 0 auto;
}

#sticky-slot:empty {
  display: none;
}

#sticky-slot:not(:empty) {
  padding: 10px 0 0;
}

#timeline {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 26px max(24px, calc((100% - var(--q-thread-max)) / 2)) 42px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  background: var(--q-panel);
}

#timeline::before {
  display: none;
}

.jump-latest {
  position: absolute;
  z-index: 8;
  right: 24px;
  bottom: 174px;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--q-line);
  border-radius: 999px;
  color: var(--q-ink);
  background: var(--q-panel);
  box-shadow: var(--q-shadow-soft);
  font-size: 12px;
}

.jump-latest .icon {
  width: 15px;
  height: 15px;
}

.tl-hero {
  display: flex;
  width: min(700px, 100%);
  min-height: 260px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: clamp(28px, 9vh, 92px) auto 0;
  padding: 20px;
  text-align: center;
}

.tl-hero .hero-signal,
.tl-hero .hero-label {
  display: none;
}

.tl-hero h1 {
  max-width: 620px;
  margin: 0;
  color: var(--q-ink);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 650;
  letter-spacing: -.025em;
  line-height: 1.18;
  text-wrap: balance;
}

.tl-hero p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--q-muted);
  font-size: 13px;
}

.tl-hero p strong {
  color: var(--q-ink);
  font-weight: 580;
}

.run-overview {
  width: 100%;
  margin: 0 0 24px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--q-line);
  background: transparent;
}

.run-overview-main {
  position: relative;
  padding: 0;
}

.run-overview-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--q-muted);
  font-size: 11.5px;
}

.run-state-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--q-faint);
}

.run-state-pulse.st-RUNNING,
.run-state-pulse.st-STARTING,
.run-state-pulse.st-QUEUED {
  background: var(--q-blue);
}

.run-state-pulse.st-COMPLETED {
  background: var(--q-green);
}

.run-state-pulse.st-WAITING_APPROVAL,
.run-state-pulse.st-WAITING_INPUT {
  background: var(--q-amber);
}

.run-state-pulse.st-FAILED,
.run-state-pulse.st-CANCELLED {
  background: var(--q-red);
}

.run-overview h1 {
  max-width: 680px;
  margin: 10px 0 7px;
  padding: 0;
  color: var(--q-ink);
  font-size: 22px;
  font-weight: 640;
  letter-spacing: -.015em;
  line-height: 1.32;
}

.run-overview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--q-faint);
  font-size: 11.5px;
}

.run-overview-actions,
.run-phases {
  display: none;
}

.run-process {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#run-process-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0;
}

#run-process-body::before,
#run-process-body .msg.assistant::before,
#run-process-body .card::before {
  display: none;
}

.msg {
  width: auto;
  max-width: 92%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.msg.user,
.msg.interjection {
  align-self: flex-end;
  max-width: min(76%, 620px);
  padding: 11px 15px;
  border: 1px solid var(--q-line);
  border-radius: 14px 14px 4px 14px;
  background: #fafafa;
}

.msg.assistant {
  align-self: flex-start;
  max-width: min(92%, 760px);
  padding: 0;
}

.msg-meta {
  margin: 0 0 6px;
  color: var(--q-faint);
  font-size: 11.5px;
  font-weight: 520;
}

.msg.assistant .msg-meta {
  color: var(--q-ink);
  font-size: 13px;
  font-weight: 650;
}

.msg-content {
  color: var(--q-ink);
  font-size: 15px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.msg.user .msg-content,
.msg.interjection .msg-content {
  font-size: 14px;
  line-height: 1.58;
}

.msg.streaming .msg-content::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 16px;
  margin-left: 3px;
  border-radius: 2px;
  vertical-align: -2px;
  background: var(--q-blue);
  animation: qBlink 1s ease-in-out infinite;
}

@keyframes qBlink {
  50% { opacity: .2; }
}

.msg-content.md p,
.delivery-response.md p,
.final.md p {
  margin: .55em 0;
}

.msg-content.md ul,
.msg-content.md ol,
.delivery-response.md ul,
.delivery-response.md ol {
  margin: .55em 0;
  padding-left: 1.55em;
}

.msg-content.md pre,
.delivery-response.md pre,
.final.md pre {
  max-width: 100%;
  overflow: auto;
  border: 1px solid #2a2d32;
  border-radius: 10px;
  background: var(--q-code);
}

.msg-content.md code:not(pre code),
.delivery-response.md code:not(pre code),
.final.md code:not(pre code) {
  padding: .12em .34em;
  border-radius: 5px;
  background: #f0f1f3;
  font-size: .91em;
}

.msg-content.md h2,
.msg-content.md h3,
.msg-content.md h4,
.msg-content.md h5,
.delivery-response.md h2,
.delivery-response.md h3,
.delivery-response.md h4,
.delivery-response.md h5 {
  margin: .8em 0 .35em;
  line-height: 1.35;
}

.msg-content.md table,
.delivery-response.md table,
.final.md table {
  border-collapse: collapse;
  margin: .55em 0;
  font-size: .92em;
}

.msg-content.md th,
.msg-content.md td,
.delivery-response.md th,
.delivery-response.md td,
.final.md th,
.final.md td {
  border: 1px solid #e3e5e8;
  padding: 3px 9px;
}

.msg-content.md th,
.delivery-response.md th,
.final.md th {
  background: #f3f4f6;
}

.sys {
  align-self: flex-start;
  display: flex;
  max-width: 94%;
  align-items: flex-start;
  gap: 8px;
  margin: -4px 0;
  padding: 5px 0;
  border: 0;
  color: var(--q-muted);
  background: transparent;
  font-size: 12.5px;
}

.sys-marker {
  width: 7px;
  height: 7px;
  flex: none;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--q-line-strong);
}

.card {
  border: 1px solid var(--q-line);
  border-radius: 12px;
  background: var(--q-panel);
  box-shadow: none;
}

.card-title {
  color: var(--q-ink);
  font-size: 13px;
  font-weight: 650;
}

.card.plan,
.card.steps {
  align-self: flex-start;
  width: min(680px, 94%);
  padding: 12px 14px;
  border-color: var(--q-line);
  background: #fafafa;
}

.card.plan .todo,
.card.steps .step-list {
  margin: 8px 0 0;
}

.card.plan .todo li,
.step-list li {
  min-height: 30px;
  padding: 4px 0;
  color: var(--q-muted);
  font-size: 13px;
}

.card.plan .todo li.done,
.step-list .step-ico.ok + .step-title {
  color: var(--q-faint);
  text-decoration: none;
}

.card.plan .todo li.active {
  color: var(--q-ink);
  font-weight: 600;
}

.step-tool {
  display: none;
}

.card.tool,
.tool-activity {
  align-self: flex-start;
  width: min(680px, 94%);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.tool-head {
  display: grid;
  min-height: 34px;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--q-muted);
  font-size: 12.5px;
}

.tool-kind {
  display: none;
}

.tool-name {
  min-width: 0;
  color: var(--q-muted);
  font-weight: 540;
}

.tool-args {
  min-width: 0;
  overflow: hidden;
  color: var(--q-faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-st {
  color: var(--q-muted);
  font-size: 11.5px;
}

.tool-st.ok {
  color: var(--q-green);
}

.tool-st.fail {
  color: var(--q-amber);
}

.tool-toggle {
  min-height: 28px;
  padding: 3px 7px;
  border: 0;
  color: var(--q-muted);
  background: transparent;
  font-size: 11.5px;
}

.tool-toggle:hover {
  border: 0;
  color: var(--q-ink);
  background: var(--q-panel-soft);
}

.tool-out {
  max-height: 260px;
  margin: 4px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid #2a2d32;
  border-radius: 9px;
  color: var(--q-code-ink);
  background: var(--q-code);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.msg.genfile {
  align-self: flex-start;
  width: min(680px, 94%);
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: #fafafa;
}

.msg.genfile .genfile-head {
  border-color: var(--q-line);
  color: var(--q-muted);
}

.msg.genfile .genfile-body {
  color: var(--q-muted);
  background: transparent;
}

.msg.thinking {
  align-self: flex-start;
  width: min(680px, 94%);
}

.msg.thinking .think-details {
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.msg.thinking .think-head {
  padding: 5px 0;
  color: var(--q-muted);
  font-size: 12.5px;
}

.msg.thinking .think-head::before {
  content: "";
}

.msg.thinking .think-body {
  max-height: 220px;
  margin: 4px 0;
  padding: 10px 12px;
  border-left: 2px solid var(--q-line);
  color: var(--q-muted);
  background: #fafafa;
}

.chg-row,
.art-row {
  align-self: flex-start;
  display: flex;
  width: min(680px, 94%);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--q-line);
  border-radius: 9px;
  color: var(--q-muted);
  background: #fafafa;
  font-size: 12.5px;
}

.art-row a {
  margin-left: auto;
}

.artifact-glyph {
  display: none;
}

.approval,
.input-req {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: var(--q-shadow-soft);
}

.approval {
  border-color: #edcf98;
  background: #fffdf8;
}

.input-req {
  border-color: #c8d9fb;
  background: #fbfdff;
}

.approval .body,
.input-req .body {
  margin-top: 7px;
  color: var(--q-ink);
  line-height: 1.55;
}

.approval .actions,
.input-req .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.approval-detail-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(168, 103, 12, .06);
  font-size: 12.5px;
}

.approval-detail-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
}

.approval-detail-row > span:first-child {
  color: var(--q-muted);
}

.approval-detail-row code {
  white-space: pre-wrap;
  word-break: break-word;
}

.approval-scope-note {
  margin-top: 9px;
  color: var(--q-muted);
  font-size: 11.5px;
}

.run-delivery {
  width: 100%;
  margin: 26px 0 8px;
  padding: 22px 0 4px;
  border: 0;
  border-top: 1px solid var(--q-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.delivery-heading {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 0;
}

.delivery-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--q-green);
  font-size: 12.5px;
  font-weight: 650;
}

.delivery-failed .delivery-status,
.delivery-cancelled .delivery-status {
  color: var(--q-red);
}

.delivery-heading h2 {
  margin: 0;
  color: var(--q-ink);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.015em;
  line-height: 1.3;
}

.delivery-duration {
  position: absolute;
  top: 1px;
  right: 0;
  color: var(--q-faint);
  font-size: 11.5px;
}

.delivery-response {
  margin: 16px 0 0;
  color: var(--q-ink);
  font-size: 15px;
  line-height: 1.72;
}

.delivery-response.delivery-error {
  padding: 13px 15px;
  border: 1px solid #f0c7c4;
  border-radius: 10px;
  color: var(--q-red);
  background: var(--q-red-soft);
}

.delivery-warning-list {
  margin: 14px 0 0;
  padding: 11px 13px;
  border: 1px solid #f0d8aa;
  border-radius: 10px;
  color: #75501a;
  background: var(--q-amber-soft);
  font-size: 12.5px;
}

.delivery-ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.delivery-ledger span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--q-line);
  border-radius: 9px;
  color: var(--q-muted);
  background: #fafafa;
  font-size: 12px;
}

.delivery-ledger span + span {
  padding-left: 10px;
  border-left: 1px solid var(--q-line);
}

.delivery-ledger span.is-zero {
  display: none;
}

.delivery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Composer */

#composer {
  position: relative;
  z-index: 10;
  width: min(var(--q-composer-max), calc(100% - 36px));
  max-height: min(68dvh, 620px);
  margin: 0 auto 14px;
  padding: 10px 12px 9px;
  overflow: visible;
  border: 1px solid var(--q-line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--q-shadow-soft);
}

#composer[data-mode="answer"] {
  border-color: #dcb66e;
  box-shadow: 0 8px 34px rgba(168, 103, 12, .12);
}

#composer[data-mode="running"] {
  border-color: #a9c4f5;
}

#composer[data-mode="running"]::after {
  display: none;
}

.composer-contextbar {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0 2px 5px;
  border: 0;
}

.composer-mode {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--q-muted);
  font-size: 11.5px;
}

.composer-mode strong {
  flex: none;
  color: var(--q-ink);
  font-size: 11.5px;
  font-weight: 650;
}

.composer-mode-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--q-blue);
  box-shadow: none;
}

#composer-context {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-stop-action {
  min-height: 30px;
  flex: none;
  padding: 4px 8px;
  border-color: transparent;
  color: var(--q-red);
  background: transparent;
  font-size: 12px;
}

#tpl-chips {
  display: flex;
  gap: 7px;
  margin: 2px 0 7px;
  padding: 0 1px 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

#tpl-chips:empty {
  display: none;
}

.tpl-chip {
  min-height: 30px;
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--q-line);
  border-radius: 999px;
  color: var(--q-muted);
  background: #fafafa;
  font-size: 11.5px;
}

.tpl-chip:hover,
.tpl-chip.active {
  border-color: #bcd0f6;
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

.tpl-chip .wh {
  display: inline-flex;
  min-height: 16px;
  align-items: center;
  margin-left: 5px;
  padding: 1px 4px;
  border-radius: 4px;
  color: #8a5a14;
  background: var(--q-amber-soft);
  font-size: 9px;
  font-weight: 650;
  line-height: 1;
}

.attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 3px 0 6px;
}

.attach-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--q-line);
  border-radius: 8px;
  color: var(--q-muted);
  background: #fafafa;
  font-size: 11.5px;
}

.attach-chip button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}

.composer-main-row {
  display: block;
}

#main-input {
  display: block;
  width: 100%;
  min-height: 66px;
  max-height: 210px;
  padding: 8px 4px;
  resize: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  color: var(--q-ink);
  background: transparent;
  font-size: 14.5px;
  line-height: 1.55;
}

#main-input:focus {
  border: 0;
  outline: 0 !important;
  box-shadow: none;
}

.composer-actions {
  display: flex;
  min-height: 40px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.composer-tools {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.composer-file-action,
#adv > summary {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--q-muted);
  background: transparent;
  font-size: 12px;
}

.composer-file-action:hover,
#adv > summary:hover {
  border: 0;
  color: var(--q-ink);
  background: var(--q-panel-soft);
}

.composer-file-action .icon,
#adv > summary .icon {
  width: 17px;
  height: 17px;
}

#adv {
  position: static;
  margin: 0;
  padding: 0;
  border: 0;
}

#adv > summary {
  cursor: pointer;
  list-style: none;
}

#adv > summary::-webkit-details-marker {
  display: none;
}

#adv[open] > summary {
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

.adv-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 30;
  max-height: min(65dvh, 570px);
  padding: 16px;
  overflow-y: auto;
  border: 1px solid var(--q-line);
  border-radius: 14px;
  background: var(--q-panel);
  box-shadow: var(--q-shadow-float);
}

.adv-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.adv-panel-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.adv-panel-head strong {
  font-size: 15px;
}

.adv-panel-head span {
  color: var(--q-muted);
  font-size: 11.5px;
}

.adv-grid {
  display: grid;
  width: 100%;
  max-height: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.adv-grid label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: var(--q-muted);
  font-size: 11.5px;
}

.adv-grid input,
.adv-grid select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--q-line);
  border-radius: 9px;
  color: var(--q-ink);
  background: var(--q-panel);
  font-size: 13px;
}

.adv-grid .adv-wide {
  grid-column: span 2;
}

.permission-toggle {
  display: grid !important;
  min-height: 62px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: flex-start;
  gap: 9px !important;
  padding: 10px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: #fafafa;
}

.permission-toggle input {
  width: 17px;
  min-height: 17px;
  margin: 2px 0 0;
}

.permission-toggle span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.permission-toggle strong {
  color: var(--q-ink);
  font-size: 12.5px;
}

.permission-toggle small {
  color: var(--q-muted);
  font-size: 11px;
  line-height: 1.35;
}

.submit-task {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
}

.submit-task > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.submit-task .icon {
  width: 19px;
  height: 19px;
}

.composer-foot {
  display: flex;
  min-height: 17px;
  align-items: center;
  margin: 2px 2px 0;
}

#composer-hint {
  min-width: 0;
  overflow: hidden;
  color: var(--q-faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#composer-hint.warn {
  color: var(--q-amber);
}

/* Inspector */

#rightbar {
  position: relative;
  z-index: 15;
  display: flex;
  width: auto;
  min-width: 0;
  height: auto;
  grid-column: 3;
  grid-row: 2;
  flex-direction: column;
  overflow: hidden;
  transform: none;
  visibility: hidden;
  border: 0;
  border-left: 1px solid var(--q-line);
  background: var(--q-panel);
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}

#rightbar.open {
  visibility: visible;
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.inspector-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  z-index: 8;
  width: 8px;
  cursor: col-resize;
}

.inspector-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  background: transparent;
}

.inspector-resizer:hover::after,
.inspector-resizer:focus-visible::after,
#app.resizing-inspector .inspector-resizer::after {
  background: var(--q-blue);
}

.inspector-sheet-head {
  display: flex;
  height: 54px;
  min-height: 54px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid var(--q-line);
}

.inspector-sheet-head > div {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.inspector-sheet-head .eyebrow {
  color: var(--q-faint);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.inspector-sheet-head strong {
  color: var(--q-ink);
  font: 650 14px/1.25 inherit;
}

.inspector-back {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
}

#rightbar .tabs {
  display: grid;
  min-height: 46px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  padding: 5px 8px;
  overflow: visible;
  border-bottom: 1px solid var(--q-line);
  background: var(--q-panel);
}

#rightbar .tab {
  position: relative;
  min-width: 0;
  min-height: 36px;
  padding: 6px 5px;
  border: 0;
  border-radius: 7px;
  color: var(--q-muted);
  background: transparent;
  font-size: 12.5px;
}

#rightbar .tab:hover {
  border: 0;
  color: var(--q-ink);
  background: var(--q-panel-soft);
}

#rightbar .tab.active {
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
  font-weight: 620;
}

#rightbar .pane {
  display: none;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  background: var(--q-panel);
}

#rightbar .pane.active {
  display: block;
}

.pane-empty {
  padding: 18px;
  color: var(--q-faint);
  font-size: 12.5px;
  text-align: left;
}

.pane-intro,
.subpane-title {
  display: flex;
  min-height: 54px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--q-line);
}

.pane-intro strong,
.subpane-title span {
  font-size: 13px;
  font-weight: 650;
}

.pane-intro span,
.subpane-title small {
  color: var(--q-muted);
  font-size: 11px;
}

.pane-tools {
  display: flex;
  min-height: 48px;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--q-line);
}

.tool-command {
  min-height: 34px;
  padding: 5px 8px;
  border-color: transparent;
  background: transparent;
  font-size: 11.5px;
}

.tool-command .icon {
  width: 15px;
  height: 15px;
}

.tool-command:disabled,
.composer-file-action:disabled {
  opacity: .46;
  cursor: not-allowed;
}

.publish-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px;
  padding: 9px 10px;
  border: 1px solid #b9dec8;
  border-radius: 9px;
  color: var(--q-green);
  background: var(--q-green-soft);
  font-size: 11.5px;
}

.publish-bar a {
  min-width: 0;
  overflow: hidden;
  color: var(--q-green);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-workbench {
  display: grid;
  min-width: 0;
  min-height: calc(100% - 49px);
  grid-template-columns: minmax(180px, 34%) minmax(0, 1fr);
}

.file-explorer {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--q-line);
  background: #fafafa;
}

#tree {
  min-width: 0;
  padding: 7px 5px 16px;
}

.file-tree,
.file-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-tree ul[hidden] {
  display: none;
}

.tree-item-button {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  color: var(--q-muted);
  background: transparent;
  text-align: left;
}

.tree-item-button:hover {
  border: 0;
  color: var(--q-ink);
  background: #eceeef;
}

.tree-item-button.selected {
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

.tree-item-button .tree-chevron {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform .13s ease;
}

.tree-item-button[aria-expanded="true"] .tree-chevron {
  transform: rotate(90deg);
}

.tree-item-button .tree-spacer {
  width: 14px;
  flex: none;
}

.tree-item-button .tree-kind {
  width: 15px;
  height: 15px;
  flex: none;
}

.tree-item-button .tree-label {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview,
.artifact-preview {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--q-panel);
}

.preview-toolbar {
  display: flex;
  min-height: 54px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px 7px 13px;
  border-bottom: 1px solid var(--q-line);
}

.preview-title-wrap {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.preview-title-wrap strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-title-wrap span {
  color: var(--q-faint);
  font-size: 10.5px;
}

.preview-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
}

.preview-actions .icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
}

.preview-body {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  background: #fbfbfb;
}

.code-view {
  min-width: max-content;
  margin: 0;
  padding: 12px 0 24px;
  counter-reset: code-line;
  color: #34373c;
  background: #fbfbfb;
  font: 12px/1.62 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.code-line {
  display: grid;
  min-height: 20px;
  grid-template-columns: 52px minmax(0, 1fr);
  counter-increment: code-line;
}

.code-line::before {
  content: counter(code-line);
  padding: 0 12px 0 6px;
  color: #a5a9af;
  text-align: right;
  user-select: none;
}

.code-line code {
  display: block;
  padding-right: 18px;
  white-space: pre;
}

.preview-truncated {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 7px 12px;
  border-bottom: 1px solid #ecd3a3;
  color: var(--q-amber);
  background: var(--q-amber-soft);
  font-size: 11.5px;
}

#changes {
  padding: 10px;
}

.chg {
  margin: 0 0 8px;
  overflow: hidden;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: var(--q-panel);
}

.change-summary {
  display: grid;
  min-height: 48px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
}

.change-summary .path {
  min-width: 0;
  overflow: hidden;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding: 7px 10px;
  border-top: 1px solid var(--q-line);
  color: var(--q-faint);
  background: #fafafa;
  font-size: 10.5px;
}

.diff-toggle {
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  color: var(--q-blue-strong);
  background: transparent;
  font-size: 11.5px;
}

.diff-toggle:hover {
  border: 0;
  background: var(--q-blue-soft);
}

.diff-stats {
  display: inline-flex;
  gap: 6px;
  color: var(--q-muted);
  font-size: 11px;
}

.diff-stats .plus {
  color: var(--q-green);
}

.diff-stats .minus {
  color: var(--q-red);
}

.diff {
  max-height: 520px;
  margin: 0;
  padding: 10px 0 18px;
  overflow: auto;
  border-top: 1px solid var(--q-line);
  color: #33363b;
  background: #fbfbfb;
  font: 11.5px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.diff-artifact-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  margin: 0 10px 10px;
  padding: 6px 9px;
  border: 1px solid var(--q-line);
  border-radius: 8px;
  color: var(--q-blue-strong);
  background: var(--q-panel);
  font-size: 11.5px;
  text-decoration: none;
}

.badge.created,
.badge.modified,
.badge.deleted {
  display: inline-flex;
  min-width: 28px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
}

.badge.created {
  color: var(--q-green);
  background: var(--q-green-soft);
}

.badge.modified {
  color: var(--q-amber);
  background: var(--q-amber-soft);
}

.badge.deleted {
  color: var(--q-red);
  background: var(--q-red-soft);
}

.artifact-workbench {
  display: grid;
  min-height: 100%;
  grid-template-rows: auto minmax(260px, 1fr);
}

#artifacts {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--q-line);
}

.art {
  display: grid;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  color: var(--q-ink);
  background: var(--q-panel);
}

.art.selected {
  border-color: #bcd0f6;
  background: var(--q-blue-soft);
}

.artifact-main {
  min-width: 0;
}

.artifact-name {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-meta {
  display: block;
  margin-top: 3px;
  color: var(--q-muted);
  font-size: 10.5px;
}

.artifact-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.artifact-actions button,
.artifact-actions a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--q-line);
  border-radius: 8px;
  color: var(--q-muted);
  background: var(--q-panel);
  font-size: 11.5px;
  text-decoration: none;
}

.artifact-preview {
  min-height: 260px;
}

.artifact-image {
  display: block;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  margin: 12px auto;
  object-fit: contain;
}

.artifact-frame {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
}

.artifact-text {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* 宿主工具活动完成留痕(web_search/web_fetch 等调研过程可追溯) */
.activity-done {
  padding: 3px 12px;
  color: #8a8f97;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-done::before {
  content: "✓";
  margin-right: 6px;
  color: var(--q-green, #2e7d46);
}

/* Markdown 文件预览(渲染/源码双模式) */
.md-view-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
}

.md-view-toggle {
  border: 1px solid #d9dce1;
  background: #f6f7f8;
  border-radius: 6px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
}

.md-view-toggle.active {
  background: #fff;
  border-color: var(--q-blue, #2f6fed);
  color: var(--q-blue, #2f6fed);
  font-weight: 600;
}

.md-preview {
  padding: 14px 18px 26px;
  max-width: 860px;
  color: #34373c;
  font-size: 13.5px;
  line-height: 1.7;
}

.md-preview h2,
.md-preview h3,
.md-preview h4,
.md-preview h5 {
  margin: 0.9em 0 0.4em;
  line-height: 1.35;
}

.md-preview table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12.5px;
}

.md-preview th,
.md-preview td {
  border: 1px solid #e3e5e8;
  padding: 4px 10px;
}

.md-preview th {
  background: #f3f4f6;
}

blockquote,
.md-preview blockquote,
.msg-content.md blockquote,
.delivery-response.md blockquote,
.final.md blockquote {
  margin: 6px 0;
  padding: 2px 12px;
  border-left: 3px solid #d0d5dd;
  color: #5b6168;
  background: #f8f9fa;
}

/* XLSX 只读网格预览(file/preview grid) */
.grid-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 3;
}

.grid-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.grid-tab {
  border: 1px solid #d9dce1;
  background: #f6f7f8;
  border-radius: 6px 6px 0 0;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.grid-tab.active {
  background: #fff;
  border-bottom-color: #fff;
  font-weight: 600;
}

.grid-print {
  border: 1px solid #d9dce1;
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.grid-note {
  padding: 6px 12px;
  color: var(--q-amber, #9a6a00);
  background: var(--q-amber-soft, #fdf3dc);
  font-size: 11.5px;
  border-bottom: 1px solid #ecd3a3;
}

.grid-note:empty {
  display: none;
}

.grid-wrap {
  overflow: auto;
  height: calc(100% - 40px);
}

.xlsx-grid {
  border-collapse: collapse;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  background: #fff;
}

.xlsx-grid th,
.xlsx-grid td {
  border: 1px solid #e3e5e8;
  padding: 2px 8px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xlsx-grid thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  color: #6b7078;
  font-weight: 500;
  z-index: 2;
}

.xlsx-grid .row-no {
  position: sticky;
  left: 0;
  background: #f3f4f6;
  color: #9aa0a8;
  font-weight: 400;
  min-width: 40px;
  text-align: right;
  z-index: 1;
}

#final-body {
  padding: 12px;
}

.evidence-overview {
  display: grid;
  gap: 10px;
}

.evidence-summary {
  padding: 13px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: #fafafa;
}

.evidence-summary h3 {
  margin: 0 0 6px;
  font-size: 13px;
}

.evidence-summary p {
  margin: 0;
  color: var(--q-muted);
  font-size: 12px;
  line-height: 1.5;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.evidence-card {
  min-height: 82px;
  padding: 11px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: var(--q-panel);
}

.evidence-card b {
  display: block;
  margin-bottom: 3px;
  font-size: 19px;
}

.evidence-card span {
  color: var(--q-muted);
  font-size: 11.5px;
}

.final-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0;
}

#fb-box {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--q-line);
}

#fb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fb-chip {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--q-line);
  border-radius: 999px;
  color: var(--q-muted);
  background: #fafafa;
  font-size: 11.5px;
}

.fb-chip.active {
  border-color: #bcd0f6;
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

#fb-text {
  min-height: 40px;
  border-color: var(--q-line);
  border-radius: 9px;
  font-size: 12.5px;
}

#live-body {
  padding: 10px 12px;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-section {
  margin: 14px 0 6px;
  color: var(--q-muted);
  font-size: 11.5px;
  font-weight: 620;
}

.live-out {
  max-height: 240px;
  overflow: auto;
  border: 1px solid #2a2d32;
  border-radius: 9px;
  color: var(--q-code-ink);
  background: var(--q-code);
}

#drawer {
  margin: 10px 12px 18px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: #fafafa;
}

#drawer-bar {
  display: grid;
  width: 100%;
  min-height: 48px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 0;
  border-radius: 10px;
  color: var(--q-ink);
  background: transparent;
  text-align: left;
}

#drawer-bar:hover {
  border: 0;
  background: #f0f1f2;
}

#drawer-sub {
  overflow: hidden;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#drawer-bar .icon {
  width: 15px;
  height: 15px;
  transition: transform .15s ease;
}

#drawer:not(.collapsed) #drawer-bar .icon {
  transform: rotate(180deg);
}

#drawer-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 10px 10px;
}

#drawer.collapsed #drawer-body {
  display: none;
}

.drawer-col {
  min-width: 0;
  border: 1px solid var(--q-line);
  border-radius: 8px;
  background: var(--q-panel);
}

.drawer-col h3 {
  margin: 0;
  padding: 8px 9px;
  border-bottom: 1px solid var(--q-line);
  color: var(--q-muted);
  font-size: 11.5px;
}

.drawer-scroll {
  max-height: 260px;
  overflow: auto;
}

.ev-row,
.kv {
  font-size: 10.5px;
}

/* Overlay integration */

#panel-backdrop {
  background: rgba(24, 27, 31, .28);
  backdrop-filter: blur(2px);
}

#conn-banner {
  z-index: 120;
  min-height: 38px;
  padding: 9px 14px;
  color: #6e4a14;
  background: var(--q-amber-soft);
  font-size: 12px;
}

#toast {
  z-index: 160;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 10px 13px;
  border: 1px solid var(--q-line-strong);
  border-radius: 10px;
  color: #fff;
  background: #25282d;
  box-shadow: var(--q-shadow-float);
  font-size: 12.5px;
}

#toast.err {
  border-color: #ce5a54;
  background: #8f2f2a;
}

#modal {
  z-index: 150;
  background: rgba(25, 28, 33, .38);
  backdrop-filter: blur(3px);
}

#modal-card {
  max-width: min(660px, calc(100vw - 28px));
  max-height: min(82dvh, 760px);
  border: 1px solid var(--q-line);
  border-radius: 14px;
  background: var(--q-panel);
  box-shadow: var(--q-shadow-float);
}

#modal-bar {
  min-height: 54px;
  border-bottom: 1px solid var(--q-line);
}

#modal-title {
  font-size: 15px;
  font-weight: 650;
}

#modal-body {
  padding: 18px;
  color: var(--q-ink);
}

.confirm-dialog-copy {
  margin: 0 0 14px;
  color: var(--q-muted);
  line-height: 1.6;
}

.confirm-dialog-scope {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #ecd3a3;
  border-radius: 9px;
  color: #75501a;
  background: var(--q-amber-soft);
  font-size: 12.5px;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Responsive */

@media (max-width: 1240px) {
  :root {
    --q-sidebar: 250px;
    --q-inspector: 500px;
  }

  #app.que-shell.inspector-open {
    grid-template-columns: var(--q-sidebar) minmax(390px, 1fr) minmax(390px, var(--inspector-width));
  }

  .topbar-runmeta #tb-hint {
    display: none;
  }

  .file-workbench {
    grid-template-columns: minmax(168px, 32%) minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  :root {
    --q-topbar: 56px;
  }

  #app.que-shell,
  #app.que-shell.inspector-open {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--q-topbar) minmax(0, 1fr);
  }

  #topbar {
    grid-column: 1;
    padding: 0 10px;
  }

  #sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    width: min(320px, 88vw);
    height: 100dvh;
    transform: translateX(-104%);
    border-right: 1px solid var(--q-line);
    box-shadow: 20px 0 54px rgba(25, 28, 33, .16);
    transition: transform .18s ease;
  }

  #sidebar.open {
    transform: none;
  }

  #center {
    grid-column: 1;
    grid-row: 2;
  }

  #rightbar {
    position: fixed;
    inset: 0;
    z-index: 110;
    width: 100vw;
    height: 100dvh;
    grid-column: auto;
    grid-row: auto;
    transform: translateX(104%);
    visibility: visible;
    border: 0;
    box-shadow: none;
    opacity: 1;
    transition: transform .18s ease;
  }

  #rightbar.open {
    transform: none;
  }

  .inspector-resizer {
    display: none;
  }

  .inspector-sheet-head {
    height: 56px;
    min-height: 56px;
    padding: 0 8px;
  }

  #panel-backdrop:not(.hidden) {
    display: block !important;
    inset: 0;
    z-index: 90;
  }

  .only-mobile {
    display: inline-flex;
  }

  .mobile-brand .brand-mark {
    width: 28px;
    height: 28px;
  }

  .topbar-breadcrumbs .tb-item {
    max-width: min(28vw, 190px);
  }

  .file-workbench {
    grid-template-columns: minmax(180px, 32%) minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  #topbar {
    gap: 4px;
    padding-inline: 7px;
  }

  .topbar-context {
    gap: 7px;
  }

  .topbar-runmeta {
    display: flex !important;
  }

  .topbar-runmeta #tb-elapsed,
  .topbar-runmeta #tb-hint,
  #btn-help,
  #btn-approve-mode > span,
  .inspector-trigger > span {
    display: none !important;
  }

  .topbar-breadcrumbs .tb-item {
    max-width: 26vw;
  }

  .thread-toolbar {
    height: 44px;
    min-height: 44px;
    padding: 0 12px;
  }

  .thread-identity > div span,
  .workspace-signal,
  #btn-thread-inspector span {
    display: none;
  }

  #btn-thread-inspector {
    width: 36px;
    min-width: 36px;
    padding: 0;
  }

  #center {
    grid-template-rows: 44px auto minmax(0, 1fr) auto;
  }

  #timeline {
    padding: 20px 14px 30px;
  }

  .tl-hero {
    min-height: 190px;
    margin-top: clamp(20px, 7vh, 54px);
    padding: 12px 8px;
  }

  .tl-hero h1 {
    font-size: 26px;
  }

  .tl-hero p {
    justify-content: center;
    flex-wrap: wrap;
    font-size: 12px;
  }

  #sticky-slot {
    width: calc(100% - 20px);
  }

  .msg.user,
  .msg.interjection {
    max-width: 88%;
  }

  .msg.assistant,
  .card.plan,
  .card.steps,
  .card.tool,
  .msg.genfile,
  .msg.thinking,
  .chg-row,
  .art-row {
    max-width: 100%;
    width: 100%;
  }

  .msg-content {
    font-size: 14.5px;
  }

  .run-overview h1 {
    font-size: 20px;
  }

  .delivery-heading h2 {
    padding-right: 0;
    font-size: 21px;
  }

  .delivery-duration {
    position: static;
  }

  .delivery-ledger {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .delivery-ledger span {
    justify-content: center;
  }

  #composer {
    width: calc(100% - 16px);
    margin-bottom: max(8px, env(safe-area-inset-bottom));
    padding: 8px 9px 7px;
    border-radius: 14px;
  }

  #tpl-chips {
    margin-right: -9px;
    padding-right: 20px;
  }

  #main-input {
    min-height: 72px;
    max-height: 156px;
    padding-inline: 3px;
  }

  .composer-actions {
    align-items: center;
  }

  .composer-tools {
    gap: 1px;
  }

  .composer-file-action,
  #adv > summary {
    min-width: 40px;
    min-height: 40px;
    padding: 6px 7px;
  }

  .composer-file-action span,
  #adv > summary span {
    display: none;
  }

  .submit-task {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .composer-foot {
    display: none;
  }

  .adv-panel {
    position: fixed;
    inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px;
    max-height: calc(100dvh - 24px);
    padding: 14px;
  }

  .adv-grid {
    grid-template-columns: 1fr;
  }

  .adv-grid .adv-wide {
    grid-column: auto;
  }

  .permission-toggle {
    min-height: 64px;
  }

  .jump-latest {
    right: 12px;
    bottom: 150px;
  }

  #rightbar .tabs {
    min-height: 50px;
    padding: 5px;
  }

  #rightbar .tab {
    min-height: 40px;
    padding-inline: 2px;
    font-size: 12px;
  }

  .pane-tools {
    min-height: 50px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .tool-command {
    min-height: 40px;
    flex: none;
  }

  .file-workbench {
    display: grid;
    min-height: calc(100% - 51px);
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 36%) minmax(0, 1fr);
  }

  .file-explorer {
    border-right: 0;
    border-bottom: 1px solid var(--q-line);
  }

  .file-explorer .subpane-title {
    min-height: 44px;
  }

  .artifact-workbench {
    grid-template-rows: auto minmax(240px, 1fr);
  }

  .artifact-frame {
    min-height: 340px;
  }

  .approval .actions,
  .input-req .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .approval .actions .btn,
  .input-req .actions .btn {
    min-height: 44px;
  }

  .approval-detail-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .evidence-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* -------------------------------------------------------------------------
 * Delivery-first polish · 2026-08
 *
 * One calm task studio: teal is reserved for the current hand-off, technical
 * evidence stays quiet, and the result has a physical place the user can open.
 * ------------------------------------------------------------------------- */
:root {
  --q-bg: #f7f9f8;
  --q-panel: #ffffff;
  --q-panel-soft: #f2f6f4;
  --q-panel-hover: #eaf2ef;
  --q-ink: #18302a;
  --q-muted: #64746e;
  --q-faint: #8d9a95;
  --q-line: #dfe8e4;
  --q-line-strong: #c8d7d1;
  --q-blue: #0f7660;
  --q-blue-strong: #0b5f4d;
  --q-blue-soft: #e7f4f0;
  --q-green: #20865f;
  --q-green-soft: #e9f6ef;
  --q-amber: #a26412;
  --q-amber-soft: #fff5df;
  --q-red: #bf4b42;
  --q-red-soft: #fff0ee;
  --q-shadow-soft: 0 1px 2px rgba(25, 46, 39, .04), 0 12px 30px rgba(25, 46, 39, .06);
  --q-shadow-float: 0 18px 50px rgba(25, 46, 39, .16);
  --q-thread-max: 900px;
  --q-composer-max: 900px;
  --q-radius-card: 13px;
}

html,
body {
  background: var(--q-bg);
  color: var(--q-ink);
  font-family: "Aptos", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}

#topbar {
  background: rgba(255, 255, 255, .94);
  border-bottom-color: var(--q-line);
}

#topbar .brand-mark,
.brand-mark {
  background: var(--q-blue);
}

#sidebar {
  background: #f1f5f3;
  border-right: 1px solid var(--q-line);
}

#sidebar .usage {
  display: none;
}

#sidebar.usage-alert .usage {
  display: block;
  margin-top: 6px;
  padding-top: 8px;
  border-top-color: var(--q-line);
}

.sidebar-link {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  margin-top: 3px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  color: var(--q-muted);
  background: transparent;
  font-size: 12px;
  text-align: left;
}

#btn-sidebar-help {
  display: none;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  color: var(--q-ink);
  background: rgba(15, 118, 96, .08);
}

.sidebar-link .icon {
  width: 15px;
  height: 15px;
}

.sidebar-advanced {
  display: none;
}

.sidebar-advanced[open] {
  display: block;
  margin-top: 5px;
  padding: 8px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .7);
}

#center {
  background: var(--q-panel);
}

#timeline {
  padding-top: 34px;
  padding-bottom: 36px;
}

#run-process-body {
  gap: 18px;
}

.msg.user,
.msg.interjection {
  align-self: flex-end;
  border: 1px solid #cfe4dc;
  background: #f0f8f5;
  color: #173c31;
  box-shadow: none;
}

.msg.assistant {
  align-self: flex-start;
  max-width: 860px;
  color: var(--q-ink);
}

.msg.assistant .msg-meta {
  color: var(--q-blue-strong);
  font-weight: 650;
}

.msg.assistant.continuation .msg-meta {
  display: none;
}

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

.activity-progress,
.activity-done,
.card.tool-group {
  border-color: var(--q-line);
  background: #fbfdfc;
}

.activity-progress-dot,
.tool-group-pulse {
  background: var(--q-blue);
}

.run-delivery {
  width: min(860px, 100%);
  margin: 26px auto 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--q-line);
  border-top: 3px solid var(--q-blue);
  border-radius: var(--q-radius-card);
  background: #fff;
  box-shadow: var(--q-shadow-soft);
}

.delivery-heading {
  align-items: center;
  margin-bottom: 12px;
}

.delivery-status {
  color: var(--q-blue-strong);
  font-weight: 700;
}

.delivery-summary-details {
  margin-top: 8px;
  border-top: 1px solid var(--q-line);
}

.delivery-summary-details > summary {
  padding: 12px 0 4px;
  color: var(--q-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}

.delivery-summary-details > summary::-webkit-details-marker {
  display: none;
}

.delivery-summary-details > summary::before {
  content: "＋";
  display: inline-block;
  width: 18px;
  color: var(--q-blue);
}

.delivery-summary-details[open] > summary::before {
  content: "−";
}

.delivery-response {
  margin-top: 8px;
  max-height: 420px;
  overflow: auto;
}

.delivery-assets {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.delivery-asset-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--q-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.delivery-asset-group-title span {
  color: var(--q-faint);
  font-weight: 550;
}

.delivery-asset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.delivery-asset {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 10px 10px 10px 11px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: var(--q-panel-soft);
}

.delivery-asset-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border-radius: 8px;
  color: var(--q-blue);
  background: var(--q-blue-soft);
}

.delivery-asset-icon .icon {
  width: 15px;
  height: 15px;
}

.delivery-asset-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
  flex: 1 1 auto;
}

.delivery-asset-copy strong,
.delivery-asset-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-asset-copy strong {
  color: var(--q-ink);
  font-size: 12px;
}

.delivery-asset-copy span {
  color: var(--q-muted);
  font-size: 10.5px;
}

.delivery-asset-actions .btn {
  min-height: 28px;
  padding-inline: 8px;
  font-size: 11px;
}

.delivery-empty-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px dashed var(--q-line-strong);
  border-radius: 10px;
  color: var(--q-muted);
  background: #fbfdfc;
}

.delivery-empty-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  color: var(--q-green);
  background: var(--q-green-soft);
  font-weight: 800;
}

.delivery-empty-result strong {
  color: var(--q-ink);
  font-size: 12px;
}

.delivery-empty-result p {
  margin: 2px 0 0;
  font-size: 11px;
}

.delivery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

#composer {
  border-color: #cfe0d9;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(25, 46, 39, .08);
}

.composer-main-row {
  min-width: 0;
}

.composer-dropzone {
  position: relative;
  min-width: 0;
  border-radius: 10px;
  transition: background .16s ease, box-shadow .16s ease;
}

.composer-dropzone.drag-active {
  background: var(--q-blue-soft);
  box-shadow: inset 0 0 0 2px var(--q-blue);
}

.composer-dropzone.is-uploading::after {
  content: "正在添加文件…";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  color: var(--q-blue-strong);
  background: rgba(231, 244, 240, .9);
  font-size: 12px;
  pointer-events: none;
}

.composer-drop-hint {
  position: absolute;
  right: 5px;
  bottom: 7px;
  color: var(--q-faint);
  font-size: 10.5px;
  pointer-events: none;
}

#main-input:not(:placeholder-shown) ~ .composer-drop-hint,
#composer[data-mode="running"] .composer-drop-hint,
#composer[data-mode="answer"] .composer-drop-hint,
#composer[data-mode="continue"] .composer-drop-hint,
#attach-chips:not(:empty) ~ .composer-main-row .composer-drop-hint {
  display: none;
}

.attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 5px;
}

.attach-chip {
  max-width: min(100%, 300px);
  border-color: #cfe4dc;
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

.attach-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-chip .icon {
  width: 13px;
  height: 13px;
}

.composer-file-action {
  color: var(--q-muted);
}

/* The top bar is the single inspector entry; keep the composer focused on
   writing the task and adding materials. */
#btn-composer-files {
  display: none !important;
}

.composer-file-action:hover {
  color: var(--q-blue-strong);
}

.project-permission {
  background: #c88422;
}

@media (max-width: 640px) {
  .delivery-asset-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .run-delivery {
    margin-top: 18px;
    padding: 15px 14px 16px;
  }

  .composer-drop-hint {
    right: 2px;
    bottom: 5px;
  }
}

@media (max-width: 960px) {
  #btn-sidebar-help {
    display: flex;
  }
}

@media (max-width: 390px) {
  .topbar-breadcrumbs #tb-ws,
  .topbar-breadcrumbs .tb-sep {
    display: none;
  }

  .topbar-breadcrumbs .tb-item {
    max-width: 34vw;
  }

  #btn-cancel span {
    display: none;
  }

  #btn-cancel,
  #btn-files,
  #btn-approve-mode {
    width: 38px;
    min-width: 38px;
    padding: 0;
  }

  #timeline {
    padding-inline: 12px;
  }

  .tl-hero h1 {
    font-size: 23px;
  }

  .composer-mode #composer-context {
    max-width: 45vw;
  }

  .composer-file-action,
  #adv > summary {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    justify-content: center;
  }

  .submit-task {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }

  .delivery-ledger {
    grid-template-columns: 1fr;
  }

  .approval .actions,
  .input-req .actions {
    grid-template-columns: 1fr;
  }

  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .art {
    grid-template-columns: 1fr;
  }

  .artifact-actions {
    justify-content: flex-start;
  }
}

/* Responsive precision and accessibility pass */

.thread-toolbar {
  grid-row: 1;
}

#sticky-slot {
  grid-row: 2;
}

#timeline {
  width: 100%;
  grid-row: 3;
}

#composer {
  min-width: 0;
  grid-row: 4;
}

#composer:focus-within {
  border-color: #9ab9f5;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, .11), var(--q-shadow-soft);
}

#composer details#adv,
#composer details#adv[open] {
  position: static;
  width: auto;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
}

#composer details#adv > summary,
#composer details#adv[open] > summary {
  margin: 0;
}

#composer details#adv .adv-panel {
  right: 0;
  left: 0;
  width: auto;
  min-width: 0;
  box-sizing: border-box;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  max-height: min(56dvh, 570px);
}

#composer details#adv .adv-grid {
  width: 100%;
  min-width: 0;
}

.adv-close-icon,
.adv-summary-close {
  display: none;
}

#sidebar[inert],
#rightbar[inert] {
  visibility: hidden;
  pointer-events: none !important;
  user-select: none;
}

#rightbar .pane[hidden] {
  display: none !important;
}

#panel-backdrop[aria-hidden="true"] {
  pointer-events: none;
}

.topbar-context,
.topbar-breadcrumbs,
.thread-identity,
.inspector-sheet-head > div,
.preview-title-wrap,
.artifact-main {
  min-width: 0;
}

.topbar-context,
.topbar-breadcrumbs {
  overflow: hidden;
}

.inspector-sheet-head > div strong,
.preview-title-wrap strong,
.preview-title-wrap span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-content,
.delivery-response,
.final,
.confirm-dialog-copy,
.confirm-dialog-scope,
.pane-error,
.pane-empty,
.publish-bar,
.artifact-meta {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pane-error {
  display: flex;
  min-width: 0;
  min-height: 56px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px;
  padding: 11px 12px;
  border: 1px solid #efc3c0;
  border-radius: 10px;
  color: #8d302b;
  background: var(--q-red-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.pane-error > span {
  min-width: 0;
  flex: 1 1 180px;
}

.pane-error .btn {
  flex: none;
}

#modal {
  padding: 12px;
}

#modal-card {
  width: min(660px, 100%);
  min-width: 0;
}

#modal-bar {
  gap: 10px;
  padding: 5px 8px 5px 15px;
}

#modal-title {
  min-width: 0;
  flex: 1;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modal-body {
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.prompt-dialog {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.prompt-dialog label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--q-muted);
  font-size: 12.5px;
  font-weight: 620;
}

.prompt-dialog input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--q-line-strong);
  border-radius: 9px;
  color: var(--q-ink);
  background: var(--q-panel);
  font-size: 14px;
  font-weight: 400;
}

.prompt-dialog input[aria-invalid="true"] {
  border-color: var(--q-red);
  box-shadow: 0 0 0 3px rgba(195, 62, 56, .12);
}

.confirm-dialog-actions {
  min-width: 0;
  flex-wrap: wrap;
}

.confirm-dialog-actions .btn {
  min-width: 88px;
  min-height: 40px;
}

@media (max-width: 960px) {
  #sidebar[inert] {
    transform: translateX(-104%) !important;
  }

  #rightbar[inert] {
    transform: translateX(104%) !important;
  }

  #rightbar {
    inset: 0;
  }
}

@media (min-width: 961px) {
  #rightbar {
    inset: auto;
  }
}

@media (max-width: 640px) {
  #composer:has(#adv[open]) {
    z-index: 140;
  }

  .icon-btn,
  .btn.small,
  .link-button,
  .side-add,
  #task-search,
  .ws-item,
  .run-item,
  .sess-item,
  .sidebar-advanced > summary,
  .nav-skills-entry,
  .tpl-chip,
  .attach-chip,
  .composer-stop-action,
  .composer-file-action,
  #adv > summary,
  .jump-latest,
  #rightbar .tab,
  .tool-command,
  .tree-item-button,
  .diff-toggle,
  .diff-artifact-link,
  .artifact-actions button,
  .artifact-actions a,
  .fb-chip,
  .tool-toggle,
  .chg-row,
  .art-row,
  .confirm-dialog-actions .btn,
  .pane-error .btn {
    min-height: 44px;
  }

  #rightbar .tool-command {
    min-height: 44px;
  }

  .icon-btn,
  #sidebar .icon-btn,
  #btn-thread-inspector,
  .composer-file-action,
  #adv > summary,
  .submit-task {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .side-add {
    width: 44px;
    min-width: 44px;
  }

  .side-section-head,
  #task-search {
    min-height: 44px;
  }

  .attach-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .attach-chip {
    flex: none;
  }

  .attach-chip button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  #main-input {
    min-height: 64px;
  }

  .adv-grid input,
  .adv-grid select,
  #fb-text,
  .skill-import select {
    min-height: 44px;
  }

  #adv[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(25, 28, 33, .32);
    backdrop-filter: blur(2px);
  }

  #composer details#adv[open] > summary {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: 15px;
    z-index: 42;
    width: auto;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--q-line);
    border-radius: 10px;
    color: var(--q-ink);
    background: var(--q-panel);
    box-shadow: var(--q-shadow-soft);
  }

  #adv[open] > summary .adv-open-icon,
  #adv[open] > summary .adv-summary-label {
    display: none;
  }

  #adv[open] > summary .adv-close-icon,
  #adv[open] > summary .adv-summary-close {
    display: inline-flex;
  }

  #composer details#adv .adv-panel {
    inset: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    z-index: 40;
    width: auto;
    max-height: none;
    padding: 62px 14px calc(20px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
    scroll-padding-top: 62px;
  }

  .adv-panel-head > div {
    min-width: 0;
  }

  .adv-panel-head span {
    overflow-wrap: anywhere;
  }

  #modal-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .confirm-dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .confirm-dialog-actions .btn {
    width: 100%;
  }
}

@media (max-width: 390px) {
  #topbar .icon-btn,
  #topbar .btn.small,
  #btn-files,
  #btn-cancel,
  #btn-approve-mode {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
  }

  .confirm-dialog-actions {
    gap: 8px;
  }
}

/* Conversation density and progressive disclosure */

.scenario-grid {
  display: grid;
  width: min(620px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.scenario-card {
  display: grid;
  min-width: 0;
  min-height: 68px;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--q-line);
  border-radius: 11px;
  color: var(--q-ink);
  background: var(--q-panel);
  text-align: left;
}

.scenario-card:hover {
  border-color: #bfd0ec;
  background: var(--q-blue-soft);
}

.scenario-card .sc-glyph {
  display: inline-flex;
  width: 34px;
  height: 34px;
  grid-row: 1 / 3;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--q-blue-strong);
  background: var(--q-blue-soft);
}

.scenario-card .sc-glyph .icon {
  width: 17px;
  height: 17px;
}

.scenario-card .sc-title {
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
}

.scenario-card .sc-sub {
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-progress {
  align-self: flex-start;
  display: flex;
  width: min(680px, 94%);
  min-height: 34px;
  align-items: center;
  gap: 8px;
  color: var(--q-muted);
  font-size: 12.5px;
}

.activity-progress-dot,
.tool-group-pulse {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--q-blue);
  box-shadow: 0 0 0 4px rgba(52, 120, 246, .1);
}

.activity-progress:not(.done) .activity-progress-dot,
.tool-group-pulse:not(.done):not(.failed) {
  animation: qPulse 1.5s ease-in-out infinite;
}

.activity-progress.done .activity-progress-dot,
.tool-group-pulse.done {
  background: var(--q-green);
  box-shadow: none;
}

.tool-group-pulse.failed {
  background: var(--q-amber);
  box-shadow: none;
}

.genfile-size {
  color: var(--q-faint);
  font-size: 11.5px;
}

.card.tool-group {
  align-self: flex-start;
  width: min(680px, 94%);
  overflow: hidden;
  border-color: var(--q-line);
  background: #fafafa;
}

.tool-group-head {
  display: grid;
  min-height: 44px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
}

.tool-group-current {
  min-width: 0;
  overflow: hidden;
  color: var(--q-ink);
  font-size: 12.5px;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-group-count {
  color: var(--q-faint);
  font-size: 11px;
}

.tool-group-details {
  border-top: 1px solid var(--q-line);
}

.tool-group-details > summary {
  min-height: 36px;
  padding: 8px 11px;
  color: var(--q-muted);
  cursor: pointer;
  font-size: 11.5px;
}

.tool-group-list {
  display: grid;
  gap: 3px;
  padding: 0 11px 10px;
}

.tool-activity-row {
  min-width: 0;
  border-top: 1px solid var(--q-line);
}

.tool-activity-row:first-child {
  border-top: 0;
}

.tool-activity-row .tool-head {
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr) auto;
}

.file-change-summary {
  align-self: flex-start;
  display: grid;
  width: min(680px, 94%);
  min-height: 58px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--q-ink);
  text-align: left;
}

.file-change-summary > .icon {
  color: var(--q-blue-strong);
}

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

.file-change-summary-main strong {
  font-size: 13px;
}

.file-change-summary-main small {
  color: var(--q-muted);
  font-size: 11.5px;
}

.file-change-summary-action {
  color: var(--q-blue-strong);
  font-size: 11.5px;
}

.diff-artifact-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px 10px;
}

.diff-artifact-controls .diff-artifact-link {
  margin: 0;
}

.diff-artifact-link.secondary {
  color: var(--q-muted);
}

.tree-loading,
.tree-empty {
  padding: 10px 9px;
  color: var(--q-faint);
  font-size: 12px;
  list-style: none;
}

.tree-more-item {
  padding: 5px 7px;
  list-style: none;
}

.tree-load-more {
  width: 100%;
  min-height: 34px;
  border: 1px dashed var(--q-line-strong);
  color: var(--q-muted);
  background: transparent;
  font-size: 11.5px;
}

.tree-error {
  margin: 6px;
  list-style: none;
}

.approval-missing {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #efc3c0;
  border-radius: 8px;
  color: #8d302b;
  background: var(--q-red-soft);
  font-size: 12px;
  line-height: 1.5;
}

.project-permission {
  flex: none;
  min-height: 17px;
  display: inline-flex;
  align-items: center;
  padding: 2px 5px;
  border-radius: 999px;
  color: #785016;
  background: var(--q-amber-soft);
  font-size: 10px;
  line-height: 1;
}

#btn-approve-mode.approval-enabled {
  color: #785016;
  background: var(--q-amber-soft);
}

.nav-skills-entry {
  justify-content: flex-start;
  margin: 5px 2px 2px;
  color: var(--q-muted);
}

.approval-settings {
  display: grid;
  gap: 16px;
}

.approval-settings-loading {
  padding: 18px 2px;
  color: var(--q-muted);
}

.approval-setting-card,
.approval-grant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  background: #fafafa;
}

.approval-setting-card.is-on {
  border-color: #edcf98;
  background: var(--q-amber-soft);
}

.approval-setting-card p,
.approval-grant-row span,
.approval-grants-heading span {
  display: block;
  margin: 4px 0 0;
  color: var(--q-muted);
  font-size: 12px;
  line-height: 1.5;
}

.approval-grants-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.approval-grants-list {
  display: grid;
  gap: 8px;
}

#fb-box {
  gap: 12px;
}

.fb-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.fb-group legend {
  margin-bottom: 7px;
  color: var(--q-muted);
  font-size: 12px;
  font-weight: 620;
}

#fb-outcomes,
#fb-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fb-submit-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

#fb-state {
  color: var(--q-muted);
  font-size: 12px;
}

@keyframes qPulse {
  50% { opacity: .42; transform: scale(.82); }
}

@media (max-width: 640px) {
  .scenario-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
  }

  .scenario-card {
    min-height: 58px;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 8px;
  }

  .scenario-card:nth-child(n + 5) {
    display: none;
  }

  .scenario-card .sc-glyph {
    width: 28px;
    height: 28px;
  }

  .scenario-card .sc-sub {
    display: none;
  }

  .tool-group-count,
  .file-change-summary-action {
    display: none;
  }

  .tool-group-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .approval-setting-card,
  .approval-grant-row {
    grid-template-columns: 1fr;
  }

  .approval-setting-card .btn,
  .approval-grant-row .btn {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 640px) and (max-height: 650px) {
  .tl-hero {
    min-height: 116px;
    margin-top: 0;
    padding-block: 4px;
  }

  .tl-hero h1 {
    max-width: 12em;
    font-size: clamp(22px, 7.2vw, 25px);
  }

  .tl-hero p {
    margin-top: 8px;
  }

  .scenario-grid {
    gap: 6px;
    margin-top: 10px;
  }

  .scenario-card {
    min-height: 52px;
  }

  .scenario-card:nth-child(n + 3) {
    display: none;
  }

  #main-input {
    min-height: 56px;
    max-height: 104px;
  }
}

@media (min-width: 1100px) {
  #app:not(.inspector-open) .scenario-grid {
    width: min(760px, 100%);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  #rightbar .pane-tools {
    display: grid;
    min-height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 10px;
    overflow: visible;
  }

  #rightbar .tool-command {
    width: 100%;
    min-width: 0;
    padding-inline: 6px;
  }

  #rightbar .file-workbench {
    min-height: calc(100% - 111px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* -------------------------------------------------------------------------
 * Visual rhythm pass
 *
 * The workbench is intentionally quiet: one reading column, one icon scale,
 * and one spacing rhythm.  These rules sit last so the older stylesheet can
 * remain in place while the new visual language wins at the cascade.
 */
:root {
  --q-sidebar: 252px;
  --q-inspector: 468px;
  --q-thread-max: 1180px;
  --q-composer-max: 1080px;
  --q-icon-size: 16px;
}

.icon {
  width: var(--q-icon-size);
  height: var(--q-icon-size);
  stroke-width: 1.75;
  vertical-align: middle;
}

.btn,
.icon-btn,
.tool-command,
.composer-file-action,
.composer-stop-action {
  line-height: 1;
  white-space: nowrap;
}

.btn.small {
  min-height: 32px;
  padding: 6px 9px;
  gap: 6px;
  font-size: 12px;
}

.btn.small .icon,
.tool-command .icon,
.composer-file-action .icon,
.composer-stop-action .icon {
  width: 15px;
  height: 15px;
}

.icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 8px;
}

#topbar {
  height: 52px;
  min-height: 52px;
  padding-inline: 18px;
  gap: 6px;
}

#topbar .topbar-context {
  gap: 12px;
}

#topbar .topbar-breadcrumbs {
  font-size: 12.5px;
}

#topbar .topbar-runmeta {
  gap: 7px;
}

#topbar .badge-status {
  min-height: 25px;
  padding: 4px 8px;
  font-size: 11px;
}

#sidebar {
  padding: 10px 10px 8px;
  background: #f5f5f4;
}

.sidebar-brand {
  height: 40px;
  min-height: 40px;
  padding-inline: 6px;
}

.brand-lockup {
  gap: 8px;
  font-size: 14px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
  background: var(--q-blue);
  font-size: 13px;
  font-weight: 750;
}

#btn-new-task.btn.command {
  min-height: 40px;
  margin: 8px 0 8px;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 13px;
}

#task-search {
  height: 36px;
  min-height: 36px;
  font-size: 12.5px;
}

.side-section {
  margin-bottom: 12px;
}

.side-section-head {
  min-height: 30px;
  padding-inline: 6px;
}

.side-h {
  font-size: 11.5px;
  letter-spacing: .04em;
}

.ws-item,
.run-item,
.sess-item {
  min-height: 38px;
  gap: 8px;
  margin-block: 1px;
  padding: 6px 8px;
  border-radius: 8px;
}

.r-title {
  font-size: 12.5px;
}

.r-time {
  font-size: 11px;
}

#center {
  grid-template-rows: 52px auto minmax(0, 1fr) auto;
}

.thread-toolbar {
  height: 52px;
  min-height: 52px;
  padding-inline: 28px;
}

.thread-identity {
  gap: 8px;
}

.thread-identity strong {
  font-size: 13px;
}

.thread-identity span:not(.agent-orbit) {
  font-size: 11px;
}

.agent-orbit {
  width: 20px;
  height: 20px;
}

.agent-orbit i {
  width: 6px;
  height: 6px;
}

.workspace-signal {
  font-size: 11px;
}

#timeline {
  padding: 30px max(32px, calc((100% - var(--q-thread-max)) / 2)) 34px;
}

#run-process-body {
  gap: 24px;
}

.run-overview {
  margin-bottom: 30px;
  padding-bottom: 22px;
}

.run-overview h1 {
  max-width: 1000px;
  margin-top: 12px;
  font-size: 26px;
  line-height: 1.28;
}

.msg {
  max-width: 100%;
}

.msg.user,
.msg.interjection {
  max-width: min(78%, 760px);
  padding: 11px 15px;
}

.msg.assistant {
  max-width: min(100%, 1020px);
}

.msg-content {
  font-size: 15px;
  line-height: 1.66;
}

.card.plan,
.card.steps,
.card.tool,
.tool-activity,
.card.tool-group,
.activity-progress {
  width: min(980px, 100%);
}

.card.plan,
.card.steps {
  padding: 14px 16px;
}

.card.tool-group {
  background: #fbfbfa;
}

.sys {
  max-width: 100%;
  font-size: 12px;
}

#composer {
  width: min(var(--q-composer-max), calc(100% - 56px));
  max-width: var(--q-composer-max);
  margin-bottom: 18px;
  padding: 11px 15px 9px;
  border-radius: 14px;
}

.composer-contextbar {
  min-height: 26px;
  padding-bottom: 5px;
}

.composer-mode {
  font-size: 11px;
}

.composer-mode strong {
  font-size: 11.5px;
}

#main-input {
  min-height: 58px;
  max-height: 144px;
  padding: 7px 2px;
  font-size: 14.5px;
  line-height: 1.5;
}

.composer-actions {
  min-height: 36px;
}

.composer-file-action,
#adv > summary {
  min-height: 32px;
  padding: 5px 7px;
  font-size: 11.5px;
}

.submit-task {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin-bottom: 0;
  border-radius: 11px;
}

.composer-foot {
  min-height: 15px;
  margin-top: 1px;
}

#composer-hint {
  font-size: 10.5px;
}

/* A running task needs a compact “send a correction” affordance, not a
   second giant panel competing with the conversation. */
#composer[data-mode="running"] {
  padding-block: 9px 7px;
}

#composer[data-mode="running"] #main-input {
  min-height: 48px;
  max-height: 82px;
}

#composer[data-mode="running"] .composer-foot {
  display: none;
}

#rightbar .tool-command {
  min-height: 32px;
  padding: 6px 8px;
  gap: 5px;
  font-size: 11.5px;
}

@media (max-width: 1100px) {
  :root {
    --q-thread-max: 980px;
    --q-composer-max: 900px;
  }

  #timeline {
    padding-inline: 26px;
  }
}

@media (max-width: 960px) {
  :root {
    --q-sidebar: 248px;
    --q-thread-max: 100%;
  }

  #timeline {
    padding-inline: 18px;
  }

  #composer {
    width: calc(100% - 28px);
  }

  .thread-toolbar {
    padding-inline: 18px;
  }
}

/* -------------------------------------------------------------------------
 * Final interaction polish
 *
 * Keep the first task hand-off visually light, reserve the prominent status
 * language for the top bar, and turn the inspector into a sheet before a
 * narrow desktop window forces the reading column below a usable width.
 * ------------------------------------------------------------------------- */

.icon {
  display: block;
}

.topbar-context {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-breadcrumbs {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-runmeta {
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
}

.thread-toolbar-actions {
  align-items: center;
  line-height: 1;
}

.workspace-signal {
  display: none;
}

.workspace-signal i {
  width: 8px;
  height: 8px;
  flex: none;
}

/* The top bar is the single global entry point for the inspector. */
#btn-thread-inspector {
  display: none;
}

.attach-chips:empty {
  display: none;
  margin: 0;
}

#composer:has(#composer-hint:empty) .composer-foot {
  display: none;
  min-height: 0;
  margin: 0;
}

#composer[data-mode="new"] .composer-contextbar,
#composer[data-mode="continue"] .composer-contextbar {
  min-height: 24px;
  padding-bottom: 2px;
}

#composer[data-mode="new"] #main-input,
#composer[data-mode="continue"] #main-input {
  min-height: 52px;
}

#composer[data-mode="answer"] #main-input {
  min-height: 62px;
}

#tpl-chips {
  margin-top: 0;
  margin-bottom: 5px;
}

@media (min-width: 961px) and (max-width: 1100px) {
  /* Preserve a readable center column; the inspector overlays as a sheet. */
  #app.que-shell.inspector-open {
    grid-template-columns: var(--q-sidebar) minmax(0, 1fr) 0;
  }

  #rightbar {
    position: fixed;
    inset: var(--q-topbar) 0 0 auto;
    z-index: 110;
    width: min(720px, 100vw);
    height: calc(100dvh - var(--q-topbar));
    grid-column: auto;
    grid-row: auto;
    transform: translateX(104%);
    visibility: visible;
    opacity: 1;
    pointer-events: none;
    border-left: 1px solid var(--q-line);
    box-shadow: -20px 0 54px rgba(25, 28, 33, .16);
    transition: transform .18s ease;
  }

  #rightbar.open {
    transform: none;
    pointer-events: auto;
  }

  .inspector-resizer {
    display: none;
  }
}

@media (max-width: 640px) {
  /* Keep a compact but honest running state visible on small screens. */
  #composer[data-mode="new"] #main-input,
  #composer[data-mode="continue"] #main-input,
  #composer[data-mode="answer"] #main-input {
    min-height: 64px;
  }

  #composer[data-mode="running"] #main-input {
    min-height: 56px;
  }

  .topbar-runmeta {
    gap: 4px;
    overflow: hidden;
  }

  .topbar-runmeta #tb-status {
    max-width: 28vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-runmeta #tb-elapsed:not(:empty) {
    display: inline !important;
    color: var(--q-faint);
    font-size: 10px;
  }

  .topbar-runmeta #tb-hint:not(.hidden) {
    display: inline !important;
    overflow: hidden;
    color: var(--q-blue-strong);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 640px) and (max-height: 650px) {
  #composer[data-mode="new"] #main-input,
  #composer[data-mode="continue"] #main-input,
  #composer[data-mode="answer"] #main-input,
  #composer[data-mode="running"] #main-input {
    min-height: 56px;
  }
}

@media (min-width: 961px) {
  /* Visual rhythm pass uses a 52px bar; keep the shell row and sheet inset in
     lock-step so the inspector does not start below a phantom 4px gutter. */
  :root {
    --q-topbar: 52px;
  }
}

/* -------------------------------------------------------------------------
 * Calm workspace pass
 *
 * The task page has one header and one narrative.  Keep transient controls
 * out of the desktop layout, let the empty state use the available canvas,
 * and remove duplicated suggestions/status furniture around the composer.
 * ------------------------------------------------------------------------- */

:root {
  --q-thread-max: 960px;
  --q-composer-max: 920px;
}

/* Generic button/icon rules must never resurrect controls that are meant to
   be hidden.  This was the source of the desktop hamburger, sidebar close X,
   and the second “more settings” icon. */
.only-mobile,
.adv-close-icon,
.adv-summary-close {
  display: none !important;
}

#adv[open] > summary .adv-open-icon,
#adv[open] > summary .adv-summary-label {
  display: none !important;
}

#adv[open] > summary .adv-close-icon,
#adv[open] > summary .adv-summary-close {
  display: inline-flex !important;
}

/* The global top bar already names the task and owns status/actions. */
#center {
  grid-template-rows: 0 auto minmax(0, 1fr) auto;
}

.thread-toolbar {
  display: none;
}

#topbar .topbar-context {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
}

.topbar-breadcrumbs {
  flex: 0 1 auto;
}

.topbar-runmeta {
  flex: 0 1 auto;
}

/* Legacy empty-state rules implicitly collapsed the grid to a 760px column.
   Restore a full-width canvas while keeping the actual reading area calm. */
#center.is-empty {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  padding: 0;
}

#center.is-empty #timeline {
  width: 100%;
  min-height: 0;
  padding: clamp(48px, 7vh, 76px) max(28px, calc((100% - var(--q-thread-max)) / 2)) 28px;
  overflow-x: hidden;
  overflow-y: auto;
}

#center.is-empty #timeline > * {
  max-width: none;
}

#center.is-empty #composer {
  width: min(var(--q-composer-max), calc(100% - 56px));
  max-width: var(--q-composer-max);
  margin: 18px auto 18px;
}

.tl-hero {
  width: min(840px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 12px 20px 0;
}

.tl-hero h1 {
  font-size: clamp(27px, 2.4vw, 34px);
}

.scenario-grid,
#app:not(.inspector-open) .scenario-grid {
  width: min(720px, 100%);
}

/* Scenario cards are the empty-state suggestions; showing the same ideas as
   a second row of chips inside the composer adds noise without adding choice. */
#tpl-chips {
  display: none;
}

#btn-composer-stop {
  display: none !important;
}

#run-process-body > .msg.user,
#run-process-body > .msg.interjection {
  width: fit-content;
  max-width: min(78%, 680px);
}

.run-overview {
  display: none;
}

#run-process-body {
  gap: 20px;
}

#composer[data-mode="running"],
#composer[data-mode="continue"] {
  padding-block: 9px 8px;
}

#composer[data-mode="running"] #main-input,
#composer[data-mode="continue"] #main-input {
  min-height: 42px;
}

.project-permission {
  width: 8px;
  min-width: 8px;
  height: 8px;
  min-height: 8px;
  padding: 0;
  border-radius: 50%;
  background: #c88422;
  color: transparent;
  font-size: 0;
}

@media (max-width: 1100px) {
  :root {
    --q-thread-max: 900px;
    --q-composer-max: 860px;
  }
}

@media (max-width: 960px) {
  .only-mobile {
    display: inline-flex !important;
  }

  #center {
    grid-template-rows: 0 auto minmax(0, 1fr) auto;
  }

  #center.is-empty #timeline {
    padding: 34px 18px 22px;
  }

  #center.is-empty #composer {
    width: calc(100% - 28px);
    margin-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .tl-hero {
    padding-inline: 6px;
  }

  .scenario-grid,
  #app:not(.inspector-open) .scenario-grid {
    width: 100%;
  }

  #run-process-body > .msg.user,
  #run-process-body > .msg.interjection {
    max-width: 88%;
  }
}

@media (max-width: 960px) {
  /* The drawer reaches the viewport edge on phones with a camera/sensor
     inset; keep the close control and account row inside the safe area. */
  #sidebar {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
}
