/*
 * Progress center and larger reading type.
 *
 * This layer intentionally loads after the base shell. Keeping live execution
 * UX here makes typography and activity changes reviewable without searching
 * through the complete workspace stylesheet.
 */
body { font-size: 16px; }
.titlebar-product,.titlebar-command { font-size: 13px; }
.titlebar-context { font-size: 12px; }
.project-rail h2,.agent-drawer h2 { font-size: 22px; }
.project-item strong,.project-rail footer strong { font-size: 13px; }
.project-item small,.project-rail footer small,.rail-files header,.rail-files > div { font-size: 11px; }
.conversation-header h1 { font-size: 27px; line-height: 1.15; }
.conversation-header p { font-size: 13px; line-height: 1.45; }
.conversation-header > div:first-child > span { font-size: 10px; }
.view-tabs button { min-height: 40px; padding-inline: 17px; font-size: 13px; font-weight: 700; }
.write-mode strong,.status-chip { font-size: 12px; }
.write-mode small { font-size: 10px; }
.quick-document-action > strong { font-size: 11px; }
.message header strong { font-size: 14px; }
.message header small,.message-purpose,.message-badge { font-size: 11px; }
.message p,.markdown-body { font-size: 16px; line-height: 1.78; }
.composer textarea { font-size: 16px; }
.mention-row button,.mention-row span,.composer-row button { font-size: 12px; }
.agent-policy strong,.agent-heading strong { font-size: 13px; }
.agent-policy small,.agent-heading small,.agent-drawer > header strong,.agent-drawer > footer { font-size: 11px; }
.agent-card p { height: 48px; font-size: 13px; line-height: 1.6; }
.summary-panel,.summary-panel p,.summary-panel li { font-size: 15px; line-height: 1.7; }

.project-title-row .live-run { min-height: 42px; max-width: min(580px,52vw); padding: 4px; }
.live-run-open { min-width: 0; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 999px; background: transparent; padding: 4px 6px; text-align: left; }
.live-run-open:hover { background: rgba(8,127,103,.07); }
.live-run-open > i { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: #087f67; animation: pulse 1.4s infinite; }
.project-title-row .live-run small { font-size: 9px; }
.project-title-row .live-run strong { max-width: 360px; font-size: 12px; line-height: 1.25; }
.live-run-track { width: 54px; height: 4px; overflow: hidden; border-radius: 999px; background: #cfe9e2; }
.live-run-track b { display: block; width: 40%; height: 100%; border-radius: inherit; background: #087f67; animation: live-run-track 1.35s ease-in-out infinite; }
.project-title-row .live-run > #cancel-runs { padding: 8px 11px; font-size: 10px; }
@keyframes live-run-track { from { transform: translateX(-110%); } to { transform: translateX(260%); } }

.activity-panel { padding: 22px 30px 36px; }
.activity-panel > header { align-items: flex-end; padding: 0 0 20px; }
.activity-panel > header > div { min-width: 0; }
.activity-panel > header span,.activity-history-heading span { color: var(--mint); font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.activity-panel > header h2 { margin: 5px 0; font-size: 30px; }
.activity-panel > header p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.activity-panel > header button { border: 1px solid var(--line2); border-radius: 9px; background: #fff; padding: 9px 13px; font-size: 12px; }
.activity-overview { display: grid; grid-template-columns: minmax(0,2fr) minmax(280px,1fr); gap: 14px; max-width: 1280px; margin: 0 auto; }
.activity-now,.activity-metrics { border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 8px 26px rgba(31,45,64,.06); }
.activity-now { min-width: 0; padding: 19px 21px; }
.activity-overview.running .activity-now { border-color: rgba(8,127,103,.24); background: linear-gradient(135deg,#edf8f5,#fff 68%); }
.activity-now-heading { display: flex; align-items: center; gap: 11px; }
.activity-now-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: #9aa6b6; }
.activity-overview.running .activity-now-dot { background: #087f67; box-shadow: 0 0 0 6px rgba(8,127,103,.1); animation: pulse 1.4s infinite; }
.activity-now-heading > div { min-width: 0; flex: 1; }
.activity-now-heading small { display: block; color: var(--mint); font-size: 11px; font-weight: 800; }
.activity-now-heading h3 { overflow: hidden; margin: 3px 0 0; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.activity-now-heading em { border-radius: 999px; background: #eef2f7; padding: 6px 10px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 800; }
.activity-overview.running .activity-now-heading em { background: #dff3ed; color: #087f67; }
.activity-now > p { min-height: 2.9em; margin: 15px 0 14px; color: #334155; font-size: 15px; line-height: 1.55; }
.activity-now-track { height: 6px; overflow: hidden; border-radius: 999px; background: #e5eaf0; }
.activity-now-track i { display: block; width: 100%; height: 100%; border-radius: inherit; background: #aeb8c6; }
.activity-overview.running .activity-now-track i { width: 38%; background: linear-gradient(90deg,#34d399,#087f67); animation: activity-track 1.6s ease-in-out infinite; }
@keyframes activity-track { from { transform: translateX(-105%); } to { transform: translateX(270%); } }
.activity-now footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 11px; color: var(--muted2); font-size: 12px; }
.activity-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: stretch; padding: 10px; }
.activity-metrics article { display: grid; align-content: center; justify-items: center; gap: 5px; min-width: 0; border-right: 1px solid var(--line); padding: 13px 8px; text-align: center; }
.activity-metrics article:last-child { border-right: 0; }
.activity-metrics small { color: var(--muted); font-size: 11px; }
.activity-metrics strong { font-size: 25px; }
.activity-history-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; max-width: 1280px; margin: 30px auto 12px; }
.activity-history-heading h3 { margin: 4px 0 0; font-size: 21px; }
.activity-history-heading small { color: var(--muted); font-size: 12px; }
.activity-list { max-width: 1280px; margin: 0 auto; gap: 11px; }
.activity-item { grid-template-columns: 46px minmax(0,1fr); gap: 14px; border-radius: 15px; padding: 16px; cursor: default; }
.activity-item.running,.activity-item.queued,.activity-item.cancelling { border-color: rgba(8,127,103,.24); background: #f7fcfa; }
.activity-item.failed { border-color: rgba(195,61,80,.22); }
.activity-avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 11px; font-weight: 900; }
.activity-copy { min-width: 0; }
.activity-item header { align-items: flex-start; gap: 12px; }
.activity-item header > div { min-width: 0; }
.activity-item strong { font-size: 15px; }
.activity-item header small { display: block; margin-top: 3px; color: var(--muted2); font-size: 11px; }
.activity-item em { border-radius: 999px; background: #eef2f7; padding: 5px 9px; color: var(--muted); font-size: 11px; font-weight: 800; }
.activity-item.running em,.activity-item.queued em,.activity-item.cancelling em { background: #dff3ed; color: #087f67; }
.activity-item.failed em { background: #fff0f2; color: var(--red); }
.activity-item > .activity-copy > p { display: -webkit-box; overflow: hidden; margin: 11px 0; color: #334155; font-size: 14px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.activity-item footer { display: flex; align-items: center; gap: 12px; color: var(--muted2); font-size: 11px; }
.activity-item footer span:nth-child(2) { margin-right: auto; }
.activity-details-toggle { border: 1px solid var(--line2); border-radius: 8px; background: #f8fafc; padding: 7px 10px; color: #334155; font-size: 11px; font-weight: 800; }
.activity-details-toggle:hover { border-color: rgba(8,127,103,.24); background: #edf8f5; color: #087f67; }
.execution-details { gap: 0; margin-top: 16px; }
.execution-event { grid-template-columns: 62px minmax(0,1fr); gap: 13px; padding: 12px 0; }
.execution-event > span { padding: 6px 8px; font-size: 10px; }
.execution-event strong { font-size: 14px; }
.execution-event p { margin: 5px 0; font-size: 13px; line-height: 1.6; }
.execution-event small { font-size: 11px; }
.record-empty { border: 1px dashed var(--line2); border-radius: 13px; background: #fff; padding: 24px; font-size: 14px; text-align: center; }

/* Durable per-agent observatory: the SQLite execution journal, not a tab-local
 * flag, drives these cards. This mirrors the desktop activity tree while
 * keeping the server workspace compact enough for a browser side rail. */
@media (min-width: 1281px) {
  .workspace-shell { grid-template-columns: 244px minmax(520px,1fr) 360px; }
}
.agent-list { gap: 10px; }
.agent-card { padding: 13px; }
.agent-card.waiting { border-color: rgba(103,84,198,.2); background: #faf9ff; }
.agent-card.waiting .agent-heading > i { background: var(--violet); }
.agent-run-state,.agent-live-meta { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.agent-run-state { margin-top: 11px; }
.agent-run-state strong { border-radius: 999px; background: #eef2f7; padding: 4px 8px; color: var(--muted); font-size: 10px; }
.agent-card.running .agent-run-state strong,.agent-card.queued .agent-run-state strong { background: #dff3ed; color: #087f67; }
.agent-card.waiting .agent-run-state strong { background: #eeeafd; color: var(--violet); }
.agent-run-state span { overflow: hidden; color: var(--muted2); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.agent-card .agent-current-action { height: auto; min-height: 0; display: -webkit-box; margin: 9px 0 3px; overflow: hidden; color: #243247; font-size: 13px; font-weight: 800; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.agent-current-detail { min-height: 31px; display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.agent-live-meta { margin: 10px 0 8px; color: var(--muted2); font-size: 10px; }
.agent-card.running .agent-live-meta span:first-child,.agent-card.queued .agent-live-meta span:first-child { color: #087f67; font-variant-numeric: tabular-nums; font-weight: 800; }
.agent-activity-details { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.agent-activity-details summary { padding: 8px 9px; color: #46556b; font-size: 10px; font-weight: 800; cursor: pointer; }
.agent-activity-rows { display: grid; max-height: 210px; overflow: auto; border-top: 1px solid var(--line); padding: 3px 8px 6px; }
.agent-activity-row { min-width: 0; display: grid; grid-template-columns: 7px minmax(0,1fr) auto; align-items: start; gap: 7px; padding: 7px 0; border-bottom: 1px solid rgba(28,39,55,.07); }
.agent-activity-row:last-child { border-bottom: 0; }
.agent-activity-row > i { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #9aa6b6; }
.agent-activity-row.running > i,.agent-activity-row.queued > i { background: #087f67; box-shadow: 0 0 0 3px rgba(8,127,103,.09); }
.agent-activity-row.failed > i { background: var(--red); }
.agent-activity-row > span { min-width: 0; }
.agent-activity-row strong,.agent-activity-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-activity-row strong { color: #243247; font-size: 10px; }
.agent-activity-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.agent-activity-row time { color: var(--muted2); font-size: 9px; font-variant-numeric: tabular-nums; }
.agent-activity-row.child { margin-left: 9px; padding-left: 8px; border-left: 2px solid rgba(103,84,198,.13); }
.agent-subagent-details { margin: 5px 0; border: 1px solid rgba(103,84,198,.16); border-radius: 8px; background: #fff; }
.agent-subagent-details > summary { min-width: 0; display: grid; grid-template-columns: 7px minmax(0,1fr) auto; align-items: center; gap: 7px; padding: 8px; list-style: none; cursor: pointer; }
.agent-subagent-details > summary::-webkit-details-marker { display: none; }
.agent-subagent-details > summary > i { width: 7px; height: 7px; border-radius: 50%; background: #9aa6b6; }
.agent-subagent-details.running > summary > i { background: var(--violet); box-shadow: 0 0 0 3px rgba(103,84,198,.1); }
.agent-subagent-details > summary strong,.agent-subagent-details > summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-subagent-details > summary strong { color: #243247; font-size: 10px; }
.agent-subagent-details > summary small,.agent-subagent-details > summary time { margin-top: 2px; color: var(--muted2); font-size: 9px; }
.agent-subagent-rows { display: grid; border-top: 1px solid rgba(28,39,55,.07); padding: 3px 7px 6px; }
.agent-subagent-rows > p { height: auto; margin: 5px 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.agent-subagent-rows > small { padding: 8px 3px; color: var(--muted2); font-size: 9px; }
.agent-card.running .agent-progress,.agent-card.queued .agent-progress { overflow: hidden; background: #dcefe9; }
.agent-card.running .agent-progress b,.agent-card.queued .agent-progress b { width: 38% !important; background: linear-gradient(90deg,#34d399,#087f67); animation: activity-track 1.6s ease-in-out infinite; }

@media (max-width: 900px) {
  .activity-overview { grid-template-columns: 1fr; }
  .activity-history-heading { align-items: flex-start; flex-direction: column; }
  .project-title-row .live-run { max-width: 100%; }
}

@media (max-width: 760px) {
  .conversation-header h1 { font-size: 22px; }
  .view-tabs button { font-size: 12px; }
  .message p,.markdown-body { font-size: 16px; }
  .activity-panel { padding: 15px 12px 28px; }
  .activity-panel > header h2 { font-size: 25px; }
  .activity-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .activity-now { padding: 16px; }
  .activity-now-heading h3 { font-size: 16px; white-space: normal; }
  .activity-item { grid-template-columns: 38px minmax(0,1fr); padding: 13px; }
  .activity-avatar { width: 36px; height: 36px; }
  .activity-item footer { align-items: flex-start; flex-wrap: wrap; }
  .activity-details-toggle { width: 100%; margin-top: 3px; }
  .execution-event { grid-template-columns: 52px minmax(0,1fr); }
  .live-run-track { display: none; }
}

/* Viewport containment: long agent trees scroll inside their rail and can
 * never grow the workspace row past the always-reachable chat composer. */
.workspace-shell {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.project-rail,
.conversation,
.agent-drawer {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.project-list,
.agent-list {
  min-height: 0;
  overscroll-behavior: contain;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

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

.chat-panel {
  min-height: 0;
  overflow: hidden;
}

.composer {
  position: relative;
  z-index: 12;
  max-height: min(42vh,360px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 -8px 24px rgba(31,45,64,.06);
}

.file-preview-body .output-preview.pdf-preview-host {
  overflow: hidden;
  padding: 0;
}

.file-preview-body .pdf-preview-frame {
  display: block;
  min-height: 420px;
  background: #eef2f7;
}

/* Compact desktop conversation chrome: keep search, project state and write
 * controls reachable while returning vertical space to the actual thread. */
@media (min-width: 761px) {
  .titlebar {
    height: 40px;
    grid-template-columns: 160px minmax(280px,580px) 1fr;
    padding-inline: 14px;
  }

  .titlebar-product {
    gap: 7px;
    font-size: 11px;
  }

  .titlebar-product span {
    width: 20px;
    height: 20px;
  }

  .titlebar-command {
    height: 28px;
    font-size: 12px;
  }

  .titlebar-context {
    font-size: 10px;
  }

  .sidebar,
  .workspace-shell {
    inset-block-start: 40px;
  }

  .conversation-header {
    min-height: 64px;
    gap: 12px;
    padding: 7px 20px 5px;
  }

  .conversation-header h1 {
    margin: 1px 0;
    font-size: 21px;
    line-height: 1.15;
  }

  .conversation-header p {
    max-width: min(68vw,760px);
    overflow: hidden;
    margin: 0;
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .conversation-header > div:first-child > span {
    font-size: 8px;
    line-height: 1.1;
  }

  .project-title-row {
    gap: 8px;
  }

  .header-actions {
    gap: 6px;
  }

  .quick-document-action,
  .write-mode {
    min-height: 32px;
    border-radius: 8px;
    padding: 4px 7px;
  }

  .quick-document-action {
    gap: 6px;
  }

  .quick-document-action > span {
    min-width: 22px;
    height: 20px;
  }

  .quick-document-action > strong,
  .write-mode strong,
  .status-chip {
    font-size: 10px;
  }

  .write-mode {
    gap: 7px;
  }

  .write-mode small {
    display: none;
  }

  .status-chip {
    padding: 5px 8px;
  }

  .project-title-row .live-run {
    min-height: 32px;
    max-width: min(500px,48vw);
    padding: 2px;
  }

  .live-run-open {
    gap: 7px;
    padding: 2px 5px;
  }

  .project-title-row .live-run small {
    display: none;
  }

  .project-title-row .live-run strong {
    max-width: 300px;
    margin: 0;
    font-size: 11px;
  }

  .live-run-track {
    width: 44px;
  }

  .project-title-row .live-run > #cancel-runs {
    padding: 6px 9px;
  }

  .view-tabs {
    margin: 0 20px 6px;
    padding: 2px;
  }

  .view-tabs button {
    min-height: 32px;
    padding-inline: 12px;
    font-size: 11px;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .conversation-header p,
  .header-actions .write-mode > span,
  .header-actions .status-chip,
  .quick-document-action > strong {
    display: none;
  }

  .quick-document-action {
    width: 32px;
    min-width: 32px;
    justify-content: center;
    padding: 0;
  }
}

/* Target workspace layout: the thread keeps the center while project identity,
 * permissions and agent status live in one independently scrolling right rail. */
.conversation {
  grid-template-rows: minmax(0,1fr) auto;
}

.context-drawer {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  padding: 0;
  background: #f8fafc;
  transition: width .18s ease,box-shadow .18s ease;
}

.context-drawer > header {
  min-height: 58px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 11px 13px;
}

.context-drawer > header h2 {
  margin: 2px 0 0;
  font-size: 17px;
}

.context-drawer > header > div:first-child > span,
.context-project-top > span:first-child,
.context-section-heading > span {
  color: #087f67;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .14em;
}

.context-drawer > header #active-count {
  white-space: nowrap;
}

.context-drawer .panel-toggle-right {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
}

.context-drawer-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.context-section {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 15px 14px;
}

.context-project-top,
.context-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.context-project-top .status-chip {
  flex: 0 0 auto;
  padding: 4px 8px;
  box-shadow: none;
  font-size: 9px;
}

.context-project-section .project-heading {
  margin-top: 10px;
}

.context-project-section .project-title-row {
  display: grid;
  align-items: stretch;
  gap: 9px;
}

.context-project-section .project-title-row h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.context-project-section #project-meta {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.context-project-section .project-title-row .live-run {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  gap: 5px;
  border-radius: 10px;
  padding: 5px;
}

.context-project-section .live-run-open {
  flex: 1;
  overflow: hidden;
}

.context-project-section .live-run-open strong {
  max-width: 180px;
}

.context-project-section .live-run-track {
  display: none;
}

.context-shortcuts {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 5px;
  margin-top: 12px;
}

.context-shortcuts button,
.context-edge button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.context-shortcuts button {
  min-width: 0;
  padding: 7px 3px;
  font-size: 10px;
}

.context-shortcuts button:hover,
.context-shortcuts button.active,
.context-edge button:hover,
.context-edge button.active {
  border-color: rgba(8,127,103,.14);
  background: #e8f5f1;
  color: #087f67;
}

.context-shortcuts button:disabled,
.context-edge button:disabled {
  cursor: not-allowed;
  opacity: .35;
}

.context-section-heading {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.context-section-heading h3 {
  margin: 0;
  font-size: 14px;
}

.context-permission-section .header-actions {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 7px;
}

.context-permission-section .quick-document-action {
  grid-column: 1 / -1;
  justify-content: center;
}

.context-permission-section .write-mode {
  min-width: 0;
  justify-content: space-between;
  gap: 6px;
  border-radius: 9px;
  padding: 8px;
  box-shadow: none;
}

.context-permission-section .write-mode > span {
  min-width: 0;
}

.context-permission-section .write-mode strong,
.context-permission-section .write-mode small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-agent-section .agent-policy {
  margin-bottom: 9px;
}

.context-agent-section .agent-list {
  overflow: visible;
  padding: 0;
}

.context-edge {
  display: none;
}

.context-drawer > footer {
  margin: 0 12px 11px;
}

.workspace-shell.right-panel-collapsed .context-drawer {
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  overflow: hidden;
  padding: 8px 5px;
}

.workspace-shell.right-panel-collapsed .context-drawer > header {
  min-height: 38px;
  justify-content: center;
  border-bottom: 0;
  padding: 0;
}

.workspace-shell.right-panel-collapsed .context-drawer > header > div:first-child,
.workspace-shell.right-panel-collapsed .context-drawer-scroll,
.workspace-shell.right-panel-collapsed .context-drawer > footer {
  display: none;
}

.workspace-shell.right-panel-collapsed .context-drawer .panel-header-actions {
  width: 100%;
  flex-direction: column-reverse;
  justify-content: center;
}

.workspace-shell.right-panel-collapsed .context-drawer #active-count {
  display: block;
  width: 40px;
  overflow: hidden;
  border: 0;
  padding: 2px 0;
  font-size: 7px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-shell.right-panel-collapsed .context-edge {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  overflow-y: auto;
  padding-top: 8px;
  scrollbar-width: none;
}

.workspace-shell.right-panel-collapsed .context-edge::-webkit-scrollbar {
  display: none;
}

.workspace-shell.right-panel-collapsed .context-edge button {
  position: relative;
  display: grid;
  min-height: 43px;
  place-items: center;
  padding: 4px 1px;
}

.workspace-shell.right-panel-collapsed .context-edge button span {
  font-size: 15px;
  line-height: 1;
}

.workspace-shell.right-panel-collapsed .context-edge button small {
  margin-top: 3px;
  font-size: 7px;
}

.workspace-shell.right-panel-collapsed .context-edge button em {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  border-radius: 999px;
  padding: 1px 4px;
  background: #dce7e4;
  color: #52645f;
  font-size: 7px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.4;
}

.workspace-shell.right-panel-collapsed .context-edge button.active em {
  background: #087f67;
  color: #fff;
}

@media (min-width: 1281px) {
  .workspace-shell {
    grid-template-columns: 280px minmax(560px,1fr) 360px;
  }

  .workspace-shell.right-panel-collapsed {
    grid-template-columns: 280px minmax(560px,1fr) 52px;
  }

  .workspace-shell.left-panel-collapsed {
    grid-template-columns: 52px minmax(560px,1fr) 360px;
  }

  .workspace-shell.left-panel-collapsed.right-panel-collapsed {
    grid-template-columns: 52px minmax(0,1fr) 52px;
  }
}

@media (min-width: 761px) and (max-width: 1280px) {
  .workspace-shell,
  .workspace-shell.right-panel-collapsed {
    grid-template-columns: 250px minmax(0,1fr) 52px;
  }

  .workspace-shell.left-panel-collapsed,
  .workspace-shell.left-panel-collapsed.right-panel-collapsed {
    grid-template-columns: 52px minmax(0,1fr) 52px;
  }

  .context-drawer {
    display: grid;
  }

  .workspace-shell:not(.right-panel-collapsed) .context-drawer {
    position: absolute;
    z-index: 24;
    inset: 0 0 0 auto;
    width: min(360px,calc(100vw - 110px));
    box-shadow: -18px 0 45px rgba(31,45,64,.16);
  }
}

@media (max-width: 760px) {
  .workspace-shell {
    grid-template-columns: minmax(0,1fr);
  }

  .conversation {
    margin-right: 48px;
  }

  .context-drawer {
    position: absolute;
    z-index: 30;
    inset: 0 0 0 auto;
    width: min(360px,calc(100vw - 8px));
    box-shadow: -18px 0 45px rgba(31,45,64,.16);
  }

  .workspace-shell.right-panel-collapsed .context-drawer {
    width: 48px;
    box-shadow: none;
  }

  .context-drawer .panel-toggle-right {
    display: grid;
  }

  .context-permission-section .header-actions {
    grid-template-columns: 1fr;
  }

  .context-permission-section .quick-document-action {
    grid-column: auto;
    width: 100%;
  }
}

/* Clean workspace refinement: fewer card layers, denser rails and one calm
 * reading surface. This intentionally changes layout density, not the app's
 * color identity or interaction model. */
.project-rail,
.context-drawer {
  background: #f8fafc;
  box-shadow: none;
}

.project-rail {
  padding: 13px 10px 10px;
}

.project-rail > header {
  padding: 0 3px 11px;
}

.project-list {
  gap: 2px;
}

.project-item {
  min-height: 48px;
  border-radius: 8px;
  padding: 6px;
}

.project-item.active {
  border-color: transparent;
  background: #e8f3f0;
  box-shadow: inset 3px 0 #087f67;
}

.conversation,
.chat-panel,
.chat-scroll {
  background: #fff;
}

.chat-scroll {
  scrollbar-gutter: stable;
}

.messages {
  width: min(940px,calc(100% - 44px));
  gap: 22px;
  padding: 28px 0 38px;
}

.message {
  grid-template-columns: 30px minmax(0,1fr);
  gap: 10px;
  margin: 0;
}

.message.user {
  margin: 0 0 0 clamp(20px,9vw,110px);
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  box-shadow: none;
}

.message > div,
.message:not(.user) > div {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 1px 0 20px;
  box-shadow: inset 0 -1px #edf0f3;
}

.message.user > div {
  border: 1px solid #dce7f5;
  border-radius: 10px;
  background: #f2f6fc;
  padding: 11px 13px;
  box-shadow: none;
}

.message header {
  align-items: baseline;
  margin-bottom: 7px;
}

.message .markdown-body {
  color: #253248;
  line-height: 1.72;
}

.chat-history-load {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 3px 0 9px;
}

.chat-history-load button {
  border: 1px solid #d8e0e8;
  border-radius: 999px;
  background: #fff;
  padding: 7px 13px;
  color: #526077;
  font-size: 11px;
  font-weight: 700;
}

.chat-history-load button:hover,
.chat-history-load button:focus-visible {
  outline: 0;
  border-color: #93c9bc;
  background: #edf8f5;
  color: #087f67;
}

.chat-history-load small {
  color: var(--muted);
  font-size: 9px;
}

.composer {
  border-top: 1px solid #e3e8ee;
  background: #fff;
  padding: 9px clamp(14px,3vw,28px) 11px;
  box-shadow: none;
}

.mention-row {
  gap: 5px;
  margin-bottom: 6px;
}

.mention-row button {
  border-radius: 6px;
  padding: 4px 7px;
  background: #f7f9fb;
  box-shadow: none;
}

.composer textarea {
  min-height: 56px;
  max-height: 150px;
  resize: none;
  border-radius: 9px;
  background: #f8fafc;
  padding: 11px 13px;
}

.composer-row #chat-send {
  width: 84px;
  border-radius: 9px;
  box-shadow: none;
}

.context-drawer > header {
  min-height: 52px;
  padding: 9px 11px;
}

.context-drawer > header h2 {
  font-size: 15px;
}

.context-section {
  padding: 12px;
}

.context-project-section .project-heading {
  margin-top: 8px;
}

.context-project-section .project-title-row h1 {
  font-size: 18px;
}

.context-shortcuts {
  gap: 4px;
  margin-top: 9px;
}

.context-shortcuts button {
  border-color: #e1e6eb;
  border-radius: 7px;
  background: #fff;
  padding: 6px 2px;
}

.context-permission-section .write-mode,
.context-agent-section .agent-policy,
.context-agent-section .agent-card {
  border-radius: 8px;
  box-shadow: none;
}

.context-agent-section .agent-card {
  padding: 9px;
}

.run-plan-dialog {
  width: min(780px,calc(100vw - 24px));
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(15,23,42,.2);
}

.run-plan-dialog::backdrop {
  background: rgba(15,23,42,.38);
  backdrop-filter: none;
}

.run-plan-dialog form {
  gap: 8px;
  padding: 14px;
}

.run-plan-request,
.run-plan-override,
.run-plan-facts article,
.run-plan-agent {
  border-radius: 8px;
  box-shadow: none;
}

.run-plan-agent {
  padding: 6px 7px;
}

.run-plan-dialog form > footer {
  bottom: -14px;
  margin: 0 -14px -14px;
  padding: 9px 14px 13px;
}

@media (min-width: 1281px) {
  .workspace-shell {
    grid-template-columns: 248px minmax(560px,1fr) 320px;
  }

  .workspace-shell.right-panel-collapsed {
    grid-template-columns: 248px minmax(560px,1fr) 48px;
  }

  .workspace-shell.left-panel-collapsed {
    grid-template-columns: 48px minmax(560px,1fr) 320px;
  }

  .workspace-shell.left-panel-collapsed.right-panel-collapsed {
    grid-template-columns: 48px minmax(0,1fr) 48px;
  }
}

@media (min-width: 761px) and (max-width: 1280px) {
  .workspace-shell,
  .workspace-shell.right-panel-collapsed {
    grid-template-columns: 228px minmax(0,1fr) 48px;
  }

  .workspace-shell.left-panel-collapsed,
  .workspace-shell.left-panel-collapsed.right-panel-collapsed {
    grid-template-columns: 48px minmax(0,1fr) 48px;
  }
}

@media (max-width: 760px) {
  .messages {
    width: calc(100% - 22px);
    gap: 18px;
    padding-block: 20px 28px;
  }

  .message.user {
    margin-left: 12px;
  }

  .composer {
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .context-drawer,
  .panel-collapse-toggle,
  .workspace-shell {
    transition: none;
  }
}
