/* ========== Icon Styles ========== */
.icon-gear {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

/* ========== Theme switch flourish ========== */
html.theme-switching .theme-toggle {
  animation: theme-toggle-pop 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

html.theme-switching .theme-toggle svg {
  animation: theme-icon-orbit 620ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes theme-toggle-pop {
  0%,
  100% {
    transform: scale(1);
  }
  36% {
    transform: scale(0.86) rotate(-8deg);
  }
  64% {
    transform: scale(1.12) rotate(8deg);
  }
}

@keyframes theme-icon-orbit {
  0% {
    transform: rotate(0deg) scale(1);
  }
  48% {
    transform: rotate(180deg) scale(0.72);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html.theme-switching .theme-toggle,
  html.theme-switching .theme-toggle svg {
    animation: none;
  }
}

#settings-button .icon-gear {
  margin-right: 0;
}

.icon-github {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

.icon-docs {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

.modal-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header .icon-gear {
  width: 20px;
  height: 20px;
}

/* ========== Cowork Command Center Refresh ========== */
.cowork-page {
  --cowork-surface: color-mix(in srgb, var(--panel-strong) 94%, var(--bg));
  --cowork-surface-2: color-mix(in srgb, var(--bg-subtle) 82%, var(--panel-strong));
  --cowork-ink: var(--text);
  --cowork-muted: var(--text-muted);
  --cowork-cyan: #0891b2;
  --cowork-green: #0f9f6e;
  --cowork-amber: #c27803;
  --cowork-red: #dc2626;
  --cowork-line: color-mix(in srgb, var(--border) 72%, transparent);
  --cowork-grid-line: color-mix(in srgb, var(--accent) 10%, transparent);
}

[data-theme="dark"] .cowork-page {
  --cowork-surface: color-mix(in srgb, var(--panel-strong) 84%, #080b12);
  --cowork-surface-2: color-mix(in srgb, var(--bg-subtle) 72%, #06070b);
  --cowork-cyan: #22d3ee;
  --cowork-green: #34d399;
  --cowork-amber: #f59e0b;
  --cowork-red: #fb7185;
  --cowork-grid-line: rgba(255, 255, 255, 0.055);
}

.cowork-page-active #cowork-modal {
  background:
    linear-gradient(var(--cowork-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--cowork-grid-line) 1px, transparent 1px),
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 46%, var(--bg)) 0%, var(--bg) 44%, color-mix(in srgb, var(--warning-soft) 44%, var(--bg)) 100%);
  background-size: 32px 32px, 32px 32px, auto;
}

.cowork-page-content {
  background: transparent;
}

.cowork-page-active .cowork-modal-content,
.cowork-modal-content {
  background: transparent;
  color: var(--cowork-ink);
}

.cowork-page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  min-height: 88px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--cowork-line);
  background: color-mix(in srgb, var(--cowork-surface) 88%, transparent);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(22px) saturate(1.12);
}

.cowork-title-block {
  position: relative;
  grid-template-columns: 56px minmax(0, 1fr);
  column-gap: 16px;
  align-items: center;
}

.cowork-title-block::before {
  content: "";
  grid-row: 1 / 4;
  display: block;
  width: 56px;
  height: 56px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--cowork-line));
  border-radius: var(--radius-sm);
  background:
    url("/assets/logo-mark.svg") center / 42px 42px no-repeat,
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 86%, #111827), color-mix(in srgb, var(--cowork-cyan) 74%, #111827)),
    var(--accent);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--accent) 28%, transparent);
}

.cowork-title-block::after {
  display: none;
}

.cowork-title-block .eyebrow {
  color: color-mix(in srgb, var(--accent) 78%, var(--cowork-cyan));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.cowork-title-block h2 {
  max-width: 760px;
  font-size: clamp(26px, 3.2vw, 44px);
  font-weight: 780;
  line-height: 0.98;
}

.cowork-title-block p:not(.eyebrow) {
  max-width: 780px;
  font-size: 14px;
}

.cowork-header-actions .button {
  min-height: 42px;
  border-radius: var(--radius-sm);
}

.cowork-header-actions #cowork-refresh-button {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--cowork-line));
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--cowork-surface));
  color: var(--accent);
}

.cowork-modal-body {
  gap: 18px;
  padding: 22px 28px 28px;
  background: transparent;
}

.cowork-create,
.cowork-session-pane,
.cowork-detail-pane,
.cowork-grid > section {
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cowork-surface) 92%, transparent);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.cowork-create {
  position: relative;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  overflow: hidden;
  padding: 18px;
  border-color: color-mix(in srgb, var(--accent) 24%, var(--cowork-line));
}

.cowork-create::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent), var(--cowork-cyan), var(--cowork-amber));
}

.cowork-create-copy {
  padding-left: 10px;
}

.cowork-kicker {
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--cowork-cyan) 35%, var(--cowork-line));
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--cowork-cyan) 10%, transparent);
  color: var(--cowork-cyan);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.cowork-create .config-label {
  color: var(--text);
  font-size: 18px;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: none;
}

.cowork-goal-input {
  min-height: 104px;
  border-color: color-mix(in srgb, var(--accent) 20%, var(--cowork-line));
  background: color-mix(in srgb, var(--panel-strong) 88%, var(--bg-subtle));
  font-size: 14px;
  line-height: 1.55;
}

.cowork-create-actions {
  align-items: center;
  justify-content: space-between;
}

.cowork-workspace {
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 18px;
}

.cowork-session-pane,
.cowork-detail-pane {
  padding: 16px;
}

.cowork-session-pane {
  gap: 14px;
  background: color-mix(in srgb, var(--cowork-surface) 82%, var(--bg));
}

.cowork-pane-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cowork-line);
}

.cowork-pane-header h3,
.cowork-detail-header h3,
.cowork-grid h4 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cowork-session-list,
.cowork-list {
  gap: 10px;
}

.cowork-session-item {
  position: relative;
  gap: 7px;
  min-height: 72px;
  padding: 13px 13px 13px 16px;
  overflow: hidden;
  border-color: var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cowork-surface) 92%, transparent);
  box-shadow: none;
}

.cowork-session-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: color-mix(in srgb, var(--text-muted) 28%, transparent);
}

.cowork-session-item:hover,
.cowork-session-item.active {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--cowork-line));
  background: color-mix(in srgb, var(--accent-soft) 58%, var(--cowork-surface));
  box-shadow: 0 12px 24px color-mix(in srgb, var(--accent) 12%, transparent);
  transform: translateY(-1px);
}

.cowork-session-item.active::before {
  background: linear-gradient(180deg, var(--accent), var(--cowork-cyan));
}

.cowork-session-title {
  font-size: 13px;
  font-weight: 760;
}

.cowork-session-meta,
.cowork-card small,
.cowork-event span {
  font-size: 11px;
}

.cowork-detail-pane {
  gap: 16px;
  overflow: hidden;
}

.cowork-detail-header {
  grid-template-columns: minmax(300px, 1fr) minmax(0, auto);
  align-items: center;
  gap: 16px;
}

.cowork-active-heading .eyebrow {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--cowork-amber) 35%, var(--cowork-line));
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--cowork-amber) 10%, transparent);
  color: var(--cowork-amber);
  font-size: 11px;
  font-weight: 800;
}

.cowork-active-heading h3 {
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 780;
  white-space: normal;
}

.cowork-run-controls {
  justify-content: flex-end;
  max-width: 720px;
}

.cowork-session-actions {
  justify-content: flex-end;
  max-width: 520px;
}

.cowork-run-controls .button {
  min-height: 38px;
  padding-inline: 12px;
  border-radius: var(--radius-sm);
}

.cowork-session-actions .button {
  min-height: 34px;
  padding-inline: 12px;
  border-radius: var(--radius-sm);
}

#cowork-delete-button {
  color: var(--danger);
}

.cowork-goal-text {
  max-width: 960px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--cowork-line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-soft) 40%, transparent);
  color: var(--cowork-muted);
}

.cowork-insight-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(180px, 0.8fr) minmax(280px, 1.3fr);
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cowork-surface-2) 76%, transparent);
}

.cowork-insight-panel[hidden] {
  display: none;
}

.cowork-insight-panel strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  text-transform: capitalize;
}

.cowork-insight-panel p {
  margin: 4px 0 0;
  color: var(--cowork-muted);
  font-size: 12px;
  line-height: 1.45;
}

.cowork-final-draft {
  max-height: 132px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--panel-strong) 86%, var(--bg-subtle));
  color: var(--cowork-ink);
  font: 12px/1.45 var(--font-mono);
  white-space: pre-wrap;
}

.cowork-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.cowork-metric {
  position: relative;
  min-height: 84px;
  overflow: hidden;
  padding: 14px 14px 12px;
  border-color: var(--cowork-line);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--panel-strong) 86%, transparent), color-mix(in srgb, var(--bg-subtle) 54%, transparent));
}

.cowork-metric::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 6px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.cowork-metric-agents::after {
  background: color-mix(in srgb, var(--accent) 42%, transparent);
}

.cowork-metric-tasks::after {
  background: color-mix(in srgb, var(--cowork-cyan) 42%, transparent);
}

.cowork-metric-messages::after {
  background: color-mix(in srgb, var(--cowork-green) 42%, transparent);
}

.cowork-metric-topics::after {
  background: color-mix(in srgb, var(--cowork-amber) 42%, transparent);
}

.cowork-metric span {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 820;
}

.cowork-metric small {
  letter-spacing: 0.1em;
}

.cowork-command-strip {
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 0.92fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cowork-surface-2) 78%, transparent);
}

.cowork-message-row,
.cowork-task-row {
  gap: 8px;
}

.cowork-command-strip .config-input,
.cowork-command-strip .config-select,
.cowork-limit-input {
  background: color-mix(in srgb, var(--panel-strong) 88%, var(--bg-subtle));
}

.cowork-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  grid-template-rows: minmax(170px, 0.9fr) minmax(170px, 0.95fr) minmax(128px, 0.7fr) minmax(120px, 0.62fr);
  gap: 12px;
}

.cowork-grid > section {
  position: relative;
  gap: 11px;
  overflow: hidden;
  padding: 14px;
}

.cowork-grid > section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cowork-cyan), transparent 72%);
  opacity: 0.84;
}

.cowork-grid h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--cowork-line);
}

.cowork-grid h4::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 14px 0 0 var(--cowork-cyan), 28px 0 0 var(--cowork-amber);
}

.cowork-team-chat {
  background: color-mix(in srgb, var(--cowork-surface) 88%, transparent);
}

.cowork-chat-list {
  padding: 2px 6px 4px 0;
}

.cowork-card,
.cowork-event,
.cowork-empty {
  border-color: var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cowork-surface) 92%, transparent);
}

.cowork-card {
  min-height: 82px;
  padding: 12px;
}

.cowork-card[tabindex]:hover,
.cowork-card.active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--cowork-line));
  background: color-mix(in srgb, var(--accent-soft) 54%, var(--cowork-surface));
  box-shadow: inset 3px 0 0 var(--accent), 0 10px 22px color-mix(in srgb, var(--accent) 10%, transparent);
}

.cowork-card strong {
  font-size: 13px;
  font-weight: 760;
}

.cowork-card p {
  font-size: 12px;
  line-height: 1.5;
}

.cowork-status {
  border-radius: var(--radius-xs);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cowork-status-active,
.cowork-status-running,
.cowork-status-in_progress,
.cowork-status-delivered,
.cowork-status-read {
  color: var(--cowork-cyan);
  background: color-mix(in srgb, var(--cowork-cyan) 13%, transparent);
  border-color: color-mix(in srgb, var(--cowork-cyan) 34%, transparent);
}

.cowork-status-completed,
.cowork-status-replied {
  color: var(--cowork-green);
  background: color-mix(in srgb, var(--cowork-green) 12%, transparent);
  border-color: color-mix(in srgb, var(--cowork-green) 34%, transparent);
}

.cowork-status-failed,
.cowork-status-blocked,
.cowork-status-expired {
  color: var(--cowork-red);
  background: color-mix(in srgb, var(--cowork-red) 12%, transparent);
  border-color: color-mix(in srgb, var(--cowork-red) 34%, transparent);
}

.cowork-status-paused,
.cowork-status-pending,
.cowork-status-idle,
.cowork-status-queued {
  color: var(--cowork-amber);
  background: color-mix(in srgb, var(--cowork-amber) 13%, transparent);
  border-color: color-mix(in srgb, var(--cowork-amber) 34%, transparent);
}

.cowork-limit-label {
  min-height: 38px;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cowork-surface-2) 78%, transparent);
}

.cowork-limit-input {
  width: 62px;
  border-radius: var(--radius-xs);
}

.cowork-lane-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 7px 0 0;
  color: var(--cowork-muted);
}

.cowork-lane-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
}

.cowork-chat-message {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
}

.cowork-chat-message.from-user {
  grid-template-columns: minmax(0, 1fr) 38px;
}

.cowork-chat-avatar {
  width: 38px;
  height: 38px;
  border-color: color-mix(in srgb, var(--accent) 24%, var(--cowork-line));
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--cowork-surface)), color-mix(in srgb, var(--cowork-cyan) 14%, var(--cowork-surface)));
  color: color-mix(in srgb, var(--accent) 82%, var(--cowork-cyan));
  font-weight: 820;
}

.cowork-chat-bubble {
  max-width: min(860px, 100%);
  padding: 12px 14px;
  border-color: var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--panel-strong) 92%, transparent);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.055);
}

.cowork-chat-message.from-user .cowork-chat-bubble {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 88%, var(--panel-strong)), color-mix(in srgb, var(--cowork-cyan) 10%, var(--panel-strong)));
}

.cowork-chat-meta {
  margin-bottom: 7px;
}

.cowork-chat-meta strong {
  font-size: 12px;
  font-weight: 780;
}

.cowork-chat-body {
  overflow-wrap: anywhere;
}

.cowork-chat-body.is-plain {
  white-space: pre-wrap;
}

.cowork-chat-body > :first-child {
  margin-top: 0;
}

.cowork-chat-body > :last-child {
  margin-bottom: 0;
}

.cowork-chat-body p,
.cowork-chat-body li {
  font-size: 13px;
  line-height: 1.55;
}

.cowork-chat-body p,
.cowork-chat-body ul,
.cowork-chat-body ol,
.cowork-chat-body blockquote,
.cowork-chat-body pre {
  margin: 0 0 9px;
}

.cowork-chat-body ul,
.cowork-chat-body ol {
  padding-left: 19px;
}

.cowork-chat-body h1,
.cowork-chat-body h2,
.cowork-chat-body h3,
.cowork-chat-body h4 {
  margin: 12px 0 7px;
  font-size: 13px;
  line-height: 1.35;
}

.cowork-chat-body code {
  padding: 1px 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--cowork-line) 55%, transparent);
  font-size: 12px;
}

.cowork-chat-body pre {
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--panel) 90%, var(--cowork-line));
}

.cowork-chat-body pre code {
  padding: 0;
  background: transparent;
}

.cowork-chat-event {
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 20px;
  padding: 1px 8px;
  border: 0;
  background: transparent;
  color: var(--cowork-muted);
  box-shadow: none;
}

.cowork-chat-event strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 620;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-chat-event .cowork-status {
  padding: 1px 5px;
  font-size: 9px;
}

.cowork-empty {
  display: grid;
  min-height: 64px;
  place-items: center;
  border-style: dashed;
  color: var(--cowork-muted);
  text-align: center;
}

.cowork-page-active {
  background: var(--bg);
}

.cowork-page-active #cowork-modal {
  min-height: 100vh;
  padding: 16px 20px 18px;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent-soft) 48%, transparent), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.54), rgba(239, 247, 253, 0.26));
}

[data-theme="dark"] .cowork-page-active #cowork-modal {
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent-soft) 28%, transparent), transparent 30%),
    linear-gradient(145deg, rgba(30, 41, 59, 0.42), rgba(15, 23, 42, 0.24));
}

.cowork-page-active .cowork-modal-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  min-height: calc(100vh - 34px);
  max-height: calc(100vh - 34px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

.cowork-page-active .cowork-page-header {
  position: relative;
  top: auto;
  min-height: 76px;
  padding: 14px 18px;
  border-radius: calc(var(--radius-xl) - 1px) calc(var(--radius-xl) - 1px) 0 0;
  box-shadow: none;
}

.cowork-page-active .cowork-modal-body {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding: 0;
}

.cowork-page-active .cowork-create {
  grid-column: 1 / -1;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  margin: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

.cowork-page-active .cowork-workspace {
  display: contents;
}

.cowork-page-active .cowork-session-pane {
  grid-column: 1;
  grid-row: 2;
  border-width: 0 1px 0 0;
  border-radius: 0 0 0 calc(var(--radius-xl) - 1px);
  box-shadow: none;
}

.cowork-page-active .cowork-detail-pane {
  grid-column: 2;
  grid-row: 2;
  overflow: auto;
  border: 0;
  border-radius: 0 0 calc(var(--radius-xl) - 1px) 0;
  background: transparent;
  box-shadow: none;
}

.cowork-graph-panel {
  display: grid;
  grid-template-rows: auto minmax(320px, 42vh) auto;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(var(--cowork-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--cowork-grid-line) 1px, transparent 1px),
    color-mix(in srgb, var(--cowork-surface) 72%, #020617);
  background-size: 28px 28px, 28px 28px, auto;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.cowork-graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cowork-line);
  background: color-mix(in srgb, var(--cowork-surface) 82%, transparent);
}

.cowork-graph-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cowork-graph-header p {
  margin: 3px 0 0;
  color: var(--cowork-muted);
  font-size: 12px;
}

.cowork-graph-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cowork-graph-controls .button {
  min-height: 30px;
  border-radius: var(--radius-xs);
}

.cowork-graph-stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  cursor: grab;
  touch-action: none;
}

.cowork-graph-stage:active {
  cursor: grabbing;
}

.cowork-graph-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
}

.cowork-agent-field-popover {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 4;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--cowork-line));
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: default;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cowork-surface) 96%, var(--accent-soft)), var(--cowork-surface));
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

.cowork-agent-field-popover[hidden] {
  display: none;
}

.cowork-agent-field-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cowork-agent-field-head h4 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
}

.cowork-agent-field-head p,
.cowork-agent-field-focus p,
.cowork-agent-field-item p,
.cowork-agent-field-empty {
  margin: 0;
  color: var(--cowork-muted);
  font-size: 12px;
  line-height: 1.45;
}

.cowork-agent-field-focus {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--cowork-surface) 78%, transparent);
}

.cowork-agent-field-focus strong,
.cowork-agent-field-section h5 {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cowork-agent-field-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cowork-agent-field-stats span {
  padding: 4px 7px;
  border: 1px solid var(--cowork-line);
  border-radius: 999px;
  color: var(--cowork-muted);
  font-size: 11px;
  font-weight: 760;
  background: color-mix(in srgb, var(--cowork-surface) 74%, transparent);
}

.cowork-agent-field-section {
  display: grid;
  gap: 6px;
}

.cowork-agent-field-item {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid var(--cowork-line);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--cowork-surface) 82%, transparent);
}

.cowork-agent-field-item.urgent {
  border-color: color-mix(in srgb, var(--cowork-amber) 44%, var(--cowork-line));
  background: color-mix(in srgb, var(--cowork-amber) 8%, var(--cowork-surface));
}

.cowork-agent-field-item strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.cowork-agent-field-route {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cowork-agent-field-route span {
  color: var(--cowork-green);
}

.cowork-agent-field-item small {
  color: var(--cowork-muted);
  font-size: 11px;
}

.cowork-graph-edge {
  fill: none;
  stroke: color-mix(in srgb, var(--cowork-cyan) 34%, transparent);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.cowork-graph-edge-task {
  stroke: color-mix(in srgb, var(--cowork-amber) 38%, transparent);
}

.cowork-graph-edge-member {
  stroke: color-mix(in srgb, var(--cowork-cyan) 30%, transparent);
}

.cowork-graph-edge-topic {
  stroke: color-mix(in srgb, var(--accent) 34%, transparent);
}

.cowork-graph-edge-discussion {
  stroke: color-mix(in srgb, var(--accent) 34%, transparent);
}

.cowork-graph-edge-message {
  stroke: color-mix(in srgb, var(--cowork-green) 42%, transparent);
  stroke-dasharray: 5 7;
}

.cowork-graph-edge-mailbox {
  stroke: color-mix(in srgb, var(--cowork-green) 42%, transparent);
  stroke-dasharray: 5 7;
}

.cowork-graph-edge-communication {
  stroke: color-mix(in srgb, var(--cowork-green) 46%, transparent);
  stroke-width: 1.8;
  stroke-dasharray: 5 7;
}

.cowork-graph-edge-depends_on,
.cowork-graph-edge-blocks {
  stroke: color-mix(in srgb, var(--cowork-red) 44%, transparent);
  stroke-dasharray: 3 6;
}

.cowork-graph-edge.pulse {
  animation: cowork-edge-pulse 1.8s linear infinite;
}

.cowork-graph-edge-label {
  pointer-events: none;
}

.cowork-graph-edge-label rect {
  fill: color-mix(in srgb, var(--cowork-surface) 92%, transparent);
  stroke: color-mix(in srgb, var(--cowork-green) 32%, var(--cowork-line));
  stroke-width: 1;
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.12));
}

.cowork-graph-edge-label text {
  fill: var(--text);
  font-size: 10px;
  font-weight: 760;
}

@keyframes cowork-edge-pulse {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

.cowork-graph-node {
  cursor: grab;
  outline: none;
}

.cowork-graph-node:active {
  cursor: grabbing;
}

.cowork-graph-node rect {
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.15));
  transition: stroke-width var(--transition-fast), filter var(--transition-fast), transform var(--transition-fast);
}

.cowork-graph-node:hover rect,
.cowork-graph-node:focus-visible rect,
.cowork-graph-node.active rect {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 34%, transparent));
}

.cowork-graph-node-session rect {
  fill: color-mix(in srgb, var(--accent-soft) 50%, var(--cowork-surface));
}

.cowork-graph-node-task rect {
  fill: color-mix(in srgb, var(--cowork-amber) 8%, var(--cowork-surface));
}

.cowork-graph-node-topic rect {
  fill: color-mix(in srgb, var(--accent-soft) 28%, var(--cowork-surface));
}

.cowork-graph-node-thread rect {
  fill: color-mix(in srgb, var(--accent-soft) 28%, var(--cowork-surface));
}

.cowork-graph-node-message rect {
  fill: color-mix(in srgb, var(--cowork-green) 8%, var(--cowork-surface));
}

.cowork-graph-node-notice {
  pointer-events: none;
}

.cowork-graph-node-notice rect {
  fill: color-mix(in srgb, var(--cowork-green) 10%, var(--cowork-surface));
  stroke: color-mix(in srgb, var(--cowork-green) 38%, var(--cowork-line));
  stroke-width: 1;
  filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.12));
}

.cowork-graph-node-notice.urgent rect {
  fill: color-mix(in srgb, var(--cowork-amber) 12%, var(--cowork-surface));
  stroke: color-mix(in srgb, var(--cowork-amber) 48%, var(--cowork-line));
}

.cowork-graph-node-notice text {
  fill: var(--text);
  font-size: 10px;
  font-weight: 760;
}

.cowork-graph-node-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 780;
}

.cowork-graph-node-meta,
.cowork-graph-node-badge,
.cowork-graph-empty-text {
  fill: var(--cowork-muted);
  font-size: 11px;
}

.cowork-graph-node-badge {
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cowork-graph-inspector {
  min-height: 34px;
  padding: 9px 14px;
  overflow: hidden;
  border-top: 1px solid var(--cowork-line);
  color: var(--cowork-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: color-mix(in srgb, var(--cowork-surface) 84%, transparent);
}

.cowork-page-active .cowork-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
}

/* Cowork as an in-shell workspace, not a separate full-page modal. */
.cowork-page-active .shell {
  display: grid;
}

.cowork-page-active .chat-panel {
  display: none;
}

.shell > .cowork-page {
  grid-column: 2;
  min-width: 0;
  min-height: 0;
}

.shell > .cowork-page.active {
  display: flex;
}

.cowork-page-active #cowork-modal {
  position: relative;
  inset: auto;
  min-height: 0;
  height: auto;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
}

.cowork-page-active #cowork-modal .modal-overlay,
.cowork-page #cowork-modal-overlay,
.cowork-page-active #cowork-modal-close {
  display: none;
}

.cowork-page-active .cowork-modal-content {
  width: 100%;
  min-height: 0;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 48% 42%, rgba(40, 48, 92, 0.16), transparent 35%),
    color-mix(in srgb, var(--panel-strong) 50%, var(--bg));
  box-shadow: none;
}

.cowork-page-active .cowork-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  min-height: 60px;
  padding: 9px 12px;
  border-radius: 0;
  background: color-mix(in srgb, var(--panel-strong) 58%, transparent);
}

.cowork-page-active .cowork-title-block {
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

.cowork-page-active .cowork-title-block::before,
.cowork-page-active .cowork-title-block::after,
.cowork-page-active .cowork-title-block p:not(.eyebrow) {
  display: none;
}

.cowork-page-active .cowork-title-block h2 {
  max-width: none;
  font-size: 18px;
  line-height: 1.2;
}

.cowork-page-active .cowork-title-block .eyebrow {
  font-size: 10px;
}

.cowork-page-active .cowork-header-actions .button {
  min-height: 32px;
  padding-inline: 10px;
}

.cowork-page-active .cowork-modal-body {
  display: grid;
  grid-template-columns: minmax(260px, 31%) minmax(0, 1fr) minmax(300px, 31%);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

.cowork-page-active .cowork-create {
  grid-column: 1 / -1;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  gap: 10px;
  padding: 8px 12px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: color-mix(in srgb, var(--panel-strong) 54%, transparent);
  box-shadow: none;
}

.cowork-page-active .cowork-create::before,
.cowork-page-active .cowork-create-copy p {
  display: none;
}

.cowork-page-active .cowork-create-copy {
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-left: 0;
}

.cowork-page-active .cowork-create .config-label {
  font-size: 13px;
}

.cowork-page-active .cowork-goal-input {
  min-height: 38px;
  max-height: 62px;
  resize: none;
}

.cowork-page-active .cowork-create-actions {
  justify-content: flex-end;
}

.cowork-page-active .cowork-workspace {
  display: contents;
}

.cowork-page-active .cowork-session-pane,
.cowork-page-active .cowork-detail-pane,
.cowork-page-active .cowork-grid > section,
.cowork-page-active .cowork-graph-panel,
.cowork-page-active .cowork-command-strip,
.cowork-page-active .cowork-insight-panel {
  border-radius: 0;
  box-shadow: none;
}

.cowork-page-active .cowork-session-pane {
  grid-column: 3;
  grid-row: 2;
  overflow: hidden;
  border-width: 0 0 0 1px;
  background: color-mix(in srgb, var(--panel-strong) 58%, transparent);
}

.cowork-page-active .cowork-session-list {
  overflow: auto;
}

.cowork-page-active .cowork-detail-pane {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: minmax(260px, 31%) minmax(0, 1fr) minmax(300px, 31%);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active .cowork-detail-header {
  grid-column: 1 / 3;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr) max-content;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--cowork-line);
  background: color-mix(in srgb, var(--panel-strong) 42%, transparent);
}

.cowork-page-active .cowork-active-heading h3 {
  font-size: 17px;
  white-space: nowrap;
}

.cowork-page-active .cowork-run-controls {
  flex-wrap: nowrap;
  max-width: none;
  overflow-x: auto;
}

.cowork-page-active .cowork-run-controls .button,
.cowork-page-active .cowork-limit-label {
  min-height: 32px;
}

.cowork-page-active .cowork-goal-text {
  grid-column: 1 / 3;
  grid-row: 2;
  max-width: none;
  padding: 8px 12px;
  border-left: 0;
  border-bottom: 1px solid var(--cowork-line);
  background: color-mix(in srgb, var(--panel-strong) 30%, transparent);
}

.cowork-page-active .cowork-metrics,
.cowork-page-active .cowork-insight-panel {
  display: none;
}

.cowork-page-active .cowork-command-strip {
  grid-column: 1 / 3;
  grid-row: 4;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  padding: 8px;
  border-width: 1px 1px 0 0;
  background: color-mix(in srgb, var(--panel-strong) 48%, transparent);
}

.cowork-page-active .cowork-graph-panel {
  grid-column: 2;
  grid-row: 3;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border-width: 0 1px 0 0;
  background:
    radial-gradient(circle at 48% 46%, rgba(55, 77, 146, 0.16), transparent 31%),
    linear-gradient(var(--cowork-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--cowork-grid-line) 1px, transparent 1px),
    #070816;
  background-size: auto, 32px 32px, 32px 32px, auto;
}

.cowork-page-active .cowork-graph-header {
  padding: 8px 10px;
  background: rgba(8, 11, 25, 0.72);
}

.cowork-page-active .cowork-graph-header h4 {
  color: rgba(226, 232, 240, 0.94);
}

.cowork-page-active .cowork-graph-stage,
.cowork-page-active .cowork-graph-svg {
  min-height: 0;
}

.cowork-page-active .cowork-graph-inspector {
  color: rgba(203, 213, 225, 0.72);
  background: rgba(8, 11, 25, 0.72);
}

.cowork-page-active .cowork-grid {
  display: contents;
}

.cowork-page-active .cowork-team-chat {
  grid-column: 1;
  grid-row: 3;
  min-height: 0;
  overflow: hidden;
  border-width: 0 1px 0 0;
}

.cowork-page-active .cowork-agents-section,
.cowork-page-active .cowork-tasks-section,
.cowork-page-active .cowork-mailbox-section,
.cowork-page-active .cowork-threads-section {
  grid-column: 3;
  min-height: 0;
  overflow: hidden;
  border-width: 0 0 1px 1px;
  background: color-mix(in srgb, var(--panel-strong) 58%, transparent);
}

.cowork-page-active .cowork-agents-section {
  grid-row: 1;
  display: none;
}

.cowork-page-active .cowork-tasks-section {
  grid-row: 1 / 3;
  margin-top: 0;
  border-top: 0;
}

.cowork-page-active .cowork-mailbox-section {
  grid-row: 3;
}

.cowork-page-active .cowork-threads-section {
  grid-row: 4;
}

.cowork-page-active .cowork-chat-list,
.cowork-page-active .cowork-list {
  min-height: 0;
  overflow: auto;
}

.cowork-page-active .cowork-session-pane {
  display: none;
}

@media (max-width: 1100px) {
  .cowork-page-header,
  .cowork-modal-body {
    padding-inline: 18px;
  }

  .cowork-title-block {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .cowork-title-block::before {
    width: 48px;
    height: 48px;
  }

  .cowork-title-block::after {
    left: 13px;
    top: 16px;
    transform: scale(0.86);
    transform-origin: top left;
  }

  .cowork-detail-header,
  .cowork-command-strip,
  .cowork-workspace,
  .cowork-grid {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: auto;
  }

  .cowork-page-active .cowork-session-pane,
  .cowork-page-active .cowork-detail-pane {
    grid-column: 1;
    border-right: 0;
    border-radius: 0;
  }

  .cowork-page-active .cowork-session-pane {
    grid-row: 2;
    border-bottom: 1px solid var(--cowork-line);
  }

  .cowork-page-active .cowork-detail-pane {
    grid-row: 3;
    overflow: visible;
  }

  .cowork-run-controls {
    justify-content: flex-start;
    max-width: none;
  }

  .cowork-session-pane {
    max-height: 280px;
  }

  .cowork-team-chat,
  .cowork-agents-section,
  .cowork-tasks-section,
  .cowork-mailbox-section,
  .cowork-threads-section {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  .cowork-page * {
    min-width: 0;
  }

  .cowork-page,
  .cowork-page-content,
  .cowork-modal-content,
  .cowork-modal-body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .cowork-page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    padding: 14px;
  }

  .cowork-title-block {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: calc(100vw - 28px);
  }

  .cowork-title-block::before,
  .cowork-title-block::after {
    display: none;
  }

  .cowork-title-block h2 {
    font-size: 26px;
  }

  .cowork-title-block p:not(.eyebrow) {
    width: min(100%, calc(100vw - 28px));
    max-width: 340px;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .cowork-header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-left: 0;
  }

  .cowork-header-actions .button {
    width: 100%;
    min-width: 0;
  }

  .cowork-modal-body {
    padding: 12px;
  }

  .cowork-create {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .cowork-page-active #cowork-modal {
    padding: 0;
  }

  .cowork-page-active .cowork-modal-content {
    min-height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .cowork-graph-panel {
    grid-template-rows: auto minmax(280px, 48vh) auto;
    min-height: 390px;
  }

  .cowork-graph-header {
    align-items: flex-start;
  }

  .cowork-graph-header p {
    max-width: 210px;
  }

  .cowork-create-copy p {
    width: min(100%, calc(100vw - 54px));
    max-width: 320px;
    overflow-wrap: anywhere;
  }

  .cowork-create-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .cowork-pane-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .cowork-pane-header .config-checkbox-label {
    justify-self: start;
  }

  .cowork-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cowork-metric {
    min-height: 74px;
  }

  .cowork-command-strip,
  .cowork-message-row,
  .cowork-task-row {
    grid-template-columns: 1fr;
  }

  .cowork-run-controls .button,
  .cowork-command-strip .button {
    width: 100%;
  }

  .cowork-chat-message,
  .cowork-chat-message.from-user {
    grid-template-columns: 1fr;
  }

  .cowork-chat-avatar,
  .cowork-chat-message.from-user .cowork-chat-avatar {
    display: none;
  }

  .cowork-chat-message.from-user .cowork-chat-bubble {
    grid-column: 1;
  }
}

/* ========== Cowork Shell Subpage ========== */
.cowork-page-active {
  overflow: hidden;
}

.cowork-page-active .shell {
  display: grid;
}

.cowork-page-active .chat-panel {
  display: none;
}

.cowork-page-active #cowork-modal {
  grid-column: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.cowork-page-active #cowork-modal .modal-overlay {
  display: none;
}

.cowork-page-active #cowork-modal-close {
  display: inline-flex;
}

.cowork-page-active .cowork-page-content,
.cowork-page-active .cowork-modal-content {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}

.cowork-page-active .cowork-page-header {
  position: static;
  min-height: 0;
  padding: 17px 22px 15px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--panel-strong) 62%, transparent);
  box-shadow: none;
  backdrop-filter: blur(18px) saturate(1.24);
  -webkit-backdrop-filter: blur(18px) saturate(1.24);
}

.cowork-page-active .cowork-title-block .eyebrow,
.cowork-page-active .cowork-title-block p:not(.eyebrow),
.cowork-page-active #cowork-refresh-button {
  display: none;
}

.cowork-page-active .cowork-title-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-width: 0;
}

.cowork-page-active .cowork-title-block::before,
.cowork-page-active .cowork-title-block::after {
  display: none;
}

.cowork-page-active .cowork-title-block .eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.cowork-page-active .cowork-title-block h2 {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-page-active .cowork-header-actions .button {
  min-height: 36px;
  border-radius: var(--radius-md);
}

.cowork-page-active .cowork-header-actions #cowork-refresh-button {
  border-color: var(--border);
  background: color-mix(in srgb, var(--panel-strong) 78%, transparent);
  color: var(--text);
}

.cowork-page-active .cowork-modal-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 22px;
  background: transparent;
}

.cowork-page-active .cowork-create,
.cowork-page-active .cowork-session-pane,
.cowork-page-active .cowork-detail-pane,
.cowork-page-active .cowork-grid > section,
.cowork-page-active .cowork-graph-panel,
.cowork-page-active .cowork-command-strip,
.cowork-page-active .cowork-insight-panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 68%, transparent);
  box-shadow: none;
  backdrop-filter: none;
}

.cowork-page-active .cowork-create {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  overflow: visible;
  border-color: var(--border-subtle);
}

.cowork-page-active .cowork-create::before {
  display: none;
}

.cowork-page-active .cowork-create-copy {
  display: none;
}

.cowork-page-active .cowork-create .config-label {
  font-size: 13px;
  font-weight: 650;
}

.cowork-page-active .cowork-kicker {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.cowork-page-active .cowork-goal-input {
  min-height: 72px;
  max-height: none;
  resize: vertical;
  border-color: var(--border);
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
}

.cowork-page-active .cowork-create-actions {
  justify-content: flex-end;
}

.cowork-page-active .cowork-create-actions .config-checkbox-label {
  display: none;
}

.cowork-page-active .cowork-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.cowork-page-active .cowork-session-pane {
  grid-column: auto;
  grid-row: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 16px;
  border-width: 1px;
}

.cowork-page-active .cowork-session-list,
.cowork-page-active .cowork-list {
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.cowork-page-active .cowork-pane-header {
  padding-bottom: 0;
  border-bottom: 0;
}

.cowork-page-active .cowork-pane-header h3,
.cowork-page-active .cowork-detail-header h3,
.cowork-page-active .cowork-grid h4 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.cowork-page-active .cowork-session-item {
  gap: 5px;
  min-height: 0;
  padding: 11px 12px;
  overflow: hidden;
  border-color: var(--border-subtle);
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
  transform: none;
}

.cowork-page-active .cowork-session-item::before {
  display: none;
}

.cowork-page-active .cowork-session-item:hover,
.cowork-page-active .cowork-session-item.active {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 56%, var(--panel-strong));
  box-shadow: 0 0 0 2px var(--accent-soft);
  transform: none;
}

.cowork-page-active .cowork-detail-pane {
  display: flex;
  grid-column: auto;
  grid-row: auto;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border-width: 1px;
}

.cowork-page-active .cowork-detail-header {
  display: flex;
  flex-direction: column;
  grid-column: auto;
  grid-row: auto;
  gap: 10px;
  min-height: 0;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.cowork-page-active .cowork-active-status,
.cowork-page-active .cowork-goal-text {
  display: none;
}

.cowork-page-active .cowork-active-heading .eyebrow {
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.cowork-page-active .cowork-active-heading h3 {
  font-size: 20px;
  font-weight: 650;
  white-space: nowrap;
}

.cowork-page-active .cowork-run-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  max-width: none;
  overflow: visible;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 54%, transparent);
}

.cowork-page-active .cowork-run-controls .button,
.cowork-page-active .cowork-limit-label {
  min-height: 32px;
}

.cowork-page-active .cowork-run-controls .button {
  padding-inline: 10px;
}

.cowork-page-active #cowork-summary-button {
  display: none;
}

.cowork-page-active #cowork-delete-button {
  display: none;
}

.cowork-page-active .cowork-goal-text {
  grid-column: auto;
  grid-row: auto;
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active .cowork-metrics,
.cowork-page-active .cowork-insight-panel {
  display: none;
}

.cowork-page-active .cowork-command-strip {
  grid-column: auto;
  grid-row: auto;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 0.9fr);
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active .cowork-graph-panel {
  grid-column: auto;
  grid-row: auto;
  display: grid;
  grid-template-rows: auto minmax(260px, 42vh) auto;
  min-height: 380px;
  overflow: hidden;
  border-width: 1px;
  background: color-mix(in srgb, var(--panel-strong) 68%, transparent);
}

.cowork-page-active .cowork-graph-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--panel-strong) 54%, transparent);
}

.cowork-page-active .cowork-graph-header h4 {
  color: var(--text);
}

.cowork-page-active .cowork-graph-header p,
.cowork-page-active .cowork-graph-inspector {
  color: var(--text-muted);
}

.cowork-page-active .cowork-graph-stage {
  min-height: 260px;
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px),
    color-mix(in srgb, var(--bg-subtle) 76%, transparent);
  background-size: 28px 28px, 28px 28px, auto;
}

.cowork-page-active .cowork-graph-svg {
  min-height: 260px;
}

.cowork-page-active .cowork-graph-inspector {
  background: color-mix(in srgb, var(--panel-strong) 54%, transparent);
}

.cowork-page-active .cowork-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  grid-template-rows: minmax(160px, 0.8fr) minmax(160px, 0.85fr) minmax(128px, 0.68fr) minmax(120px, 0.58fr);
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.cowork-page-active .cowork-team-chat {
  grid-column: 1;
  grid-row: 1 / 5;
  min-height: 0;
  overflow: hidden;
  border-width: 1px;
}

.cowork-page-active .cowork-agents-section,
.cowork-page-active .cowork-tasks-section,
.cowork-page-active .cowork-mailbox-section,
.cowork-page-active .cowork-threads-section {
  grid-column: 2;
  min-height: 0;
  overflow: auto;
  border-width: 1px;
  background: color-mix(in srgb, var(--panel-strong) 68%, transparent);
}

.cowork-page-active .cowork-agents-section {
  grid-row: 1;
  display: flex;
}

.cowork-page-active .cowork-tasks-section {
  grid-row: 2;
}

.cowork-page-active .cowork-mailbox-section {
  grid-row: 3;
}

.cowork-page-active .cowork-threads-section {
  grid-row: 4;
}

.cowork-page-active .cowork-card,
.cowork-page-active .cowork-event,
.cowork-page-active .cowork-empty,
.cowork-page-active .cowork-chat-bubble,
.cowork-page-active .cowork-chat-event,
.cowork-page-active .cowork-metric {
  border-color: var(--border-subtle);
  background: color-mix(in srgb, var(--panel-strong) 78%, transparent);
}

.cowork-page-active .cowork-chat-avatar {
  border-color: var(--border-subtle);
  background: var(--accent-soft);
}

[data-theme="dark"] .cowork-page-active #cowork-modal {
  background: rgba(15, 23, 42, 0.10);
}

@media (max-width: 1100px) {
  .cowork-page-active #cowork-modal {
    grid-column: 1;
    order: 1;
  }

  .cowork-page-active .sidebar {
    order: 2;
  }

  .cowork-page-active .cowork-workspace,
  .cowork-page-active .cowork-detail-header,
  .cowork-page-active .cowork-command-strip,
  .cowork-page-active .cowork-grid {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-session-pane {
    max-height: 280px;
  }

  .cowork-page-active .cowork-team-chat,
  .cowork-page-active .cowork-agents-section,
  .cowork-page-active .cowork-tasks-section,
  .cowork-page-active .cowork-mailbox-section,
  .cowork-page-active .cowork-threads-section {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  .cowork-page-active .cowork-page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px 18px;
  }

  .cowork-page-active .cowork-header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-left: 0;
  }

  .cowork-page-active .cowork-modal-body {
    padding: 12px;
  }

  .cowork-page-active .cowork-create {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-run-controls .button,
  .cowork-page-active .cowork-command-strip .button {
    width: 100%;
  }
}

/* ========== Sidebar Session Dropdowns ========== */
body:not(.sidebar-cowork-open):not(.sidebar-sessions-open) {
  --sidebar-active-section: sessions;
}

.sidebar-dropdown-toggle {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  margin: -3px -6px;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-dropdown-toggle:hover,
.sidebar-dropdown-toggle:focus-visible {
  background: color-mix(in srgb, var(--panel-strong) 62%, var(--bg-subtle));
  box-shadow: var(--shadow-xs);
  outline: none;
}

.sidebar-dropdown-toggle::after,
.cowork-panel .section-header::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.58;
  transform: rotate(45deg);
  transition: transform var(--transition-base), opacity var(--transition-fast);
}

.sidebar-sessions-open .sidebar-dropdown-toggle::after,
body:not(.sidebar-cowork-open):not(.sidebar-sessions-open) .sidebar-dropdown-toggle::after,
.sidebar-cowork-open .cowork-panel .section-header::after {
  opacity: 0.82;
  transform: rotate(225deg) translate(-1px, -1px);
}

.sidebar-cowork-open .sessions-panel {
  flex: 0 0 auto;
  min-height: 0;
}

.sidebar-cowork-open .session-list {
  display: none;
}

.sidebar-cowork-open .sidebar-feature-panel {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
}

.cowork-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cowork-sidebar-session-list {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
  gap: 3px;
  padding: 2px 1px 0;
}

.sidebar-cowork-open .cowork-sidebar-session-list {
  display: flex;
}

.sidebar-cowork-open .cowork-panel {
  flex: 1 1 auto;
}

.sidebar-cowork-open .cowork-panel .section-header {
  background: color-mix(in srgb, var(--accent-soft) 60%, transparent);
}

.sidebar-sessions-open .cowork-panel,
body:not(.sidebar-cowork-open):not(.sidebar-sessions-open) .cowork-panel {
  flex: 0 0 auto;
}

.session-item-wrapper,
.cowork-sidebar-session-wrapper {
  border-radius: var(--radius-sm);
}

.session-item-wrapper.expanded,
.cowork-sidebar-session-wrapper.expanded {
  background: color-mix(in srgb, var(--panel-strong) 46%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border-subtle));
  box-shadow: var(--shadow-xs);
}

.session-item-wrapper.expanded .session-item {
  padding-top: 7px;
  padding-bottom: 7px;
}

.session-item-wrapper.expanded .session-item,
.cowork-sidebar-session-wrapper.expanded .cowork-session-item {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.cowork-sidebar-session-item {
  min-height: 0;
  padding: 7px 8px;
  border-color: transparent;
  background: transparent;
}

.cowork-sidebar-session-item .cowork-session-title {
  font-size: 11px;
}

.cowork-sidebar-session-item .cowork-session-meta {
  font-size: 10px;
}

.sidebar.collapsed .sidebar-dropdown-toggle,
.sidebar.collapsed .cowork-sidebar-session-list {
  display: none;
}

/* Final cowork layout cleanup: keep actions out of the graph surface. */
.cowork-page-active #cowork-modal-close {
  display: none !important;
}

.cowork-page-active .cowork-detail-pane {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px;
  overflow: auto;
}

.cowork-page-active .cowork-detail-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
}

.cowork-page-active .cowork-run-controls {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active .cowork-run-controls .cowork-limit-label {
  display: none;
}

.cowork-page-active .cowork-run-controls .button {
  flex: 0 0 auto;
  min-height: 34px;
}

.cowork-page-active .cowork-graph-panel {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-height: 360px;
}

/* ========== Cowork Three-Column Workspace ========== */
.cowork-page-active .cowork-modal-content {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel-strong) 74%, transparent), color-mix(in srgb, var(--bg) 92%, var(--panel-strong))),
    var(--bg);
}

.cowork-page-active .cowork-page-header {
  border-bottom-color: var(--cowork-line);
  background: color-mix(in srgb, var(--panel-strong) 86%, var(--bg));
}

.cowork-page-active .cowork-modal-body {
  display: grid;
  grid-template-columns: minmax(238px, 280px) minmax(420px, 1fr) minmax(318px, 360px);
  grid-template-rows: auto auto minmax(118px, 0.38fr) minmax(142px, 0.44fr) minmax(118px, 0.34fr) minmax(98px, 0.28fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 72%, var(--panel-strong));
}

.cowork-page-active .cowork-workspace,
.cowork-page-active .cowork-detail-pane,
.cowork-page-active .cowork-grid {
  display: contents !important;
}

.cowork-page-active .cowork-create,
.cowork-page-active .cowork-session-pane,
.cowork-page-active .cowork-detail-header,
.cowork-page-active .cowork-goal-text,
.cowork-page-active .cowork-team-chat,
.cowork-page-active .cowork-graph-panel,
.cowork-page-active .cowork-command-strip,
.cowork-page-active .cowork-insight-panel,
.cowork-page-active .cowork-tasks-section,
.cowork-page-active .cowork-mailbox-section,
.cowork-page-active .cowork-threads-section {
  min-width: 0;
  min-height: 0;
  border-color: var(--cowork-line);
  border-radius: 0;
  box-shadow: none;
}

.cowork-page-active .cowork-session-pane {
  display: flex !important;
  grid-column: 1;
  grid-row: 1 / 3;
  overflow: hidden;
  border-width: 0 1px 1px 0;
  background: color-mix(in srgb, var(--panel-strong) 76%, var(--bg));
}

.cowork-page-active .cowork-team-chat {
  grid-column: 1;
  grid-row: 3 / 7;
  overflow: hidden;
  border-width: 0 1px 0 0;
  background: color-mix(in srgb, var(--panel-strong) 66%, var(--bg));
}

.cowork-page-active .cowork-detail-header {
  grid-column: 2;
  grid-row: 1;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 12px 14px;
  border-width: 0 1px 1px 0;
  background: color-mix(in srgb, var(--panel-strong) 70%, var(--bg));
}

.cowork-page-active .cowork-active-heading {
  gap: 6px;
}

.cowork-page-active .cowork-active-heading h3 {
  max-width: 100%;
  font-size: 19px;
}

.cowork-page-active .cowork-run-controls {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-start;
  overflow-x: auto;
  padding-bottom: 1px;
}

.cowork-page-active .cowork-session-actions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-start;
  overflow-x: auto;
  padding-bottom: 1px;
}

.cowork-page-active .cowork-run-controls .cowork-limit-label {
  display: inline-flex;
}

.cowork-page-active .cowork-goal-text {
  grid-column: 2;
  grid-row: 2;
  max-width: none;
  padding: 10px 14px;
  border-width: 0 1px 1px 0;
  background: color-mix(in srgb, var(--panel-strong) 52%, var(--bg));
}

.cowork-page-active .cowork-graph-panel {
  grid-column: 2;
  grid-row: 3 / 7;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  min-height: 0;
  border-width: 0 1px 0 0;
  background:
    linear-gradient(var(--cowork-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--cowork-grid-line) 1px, transparent 1px),
    radial-gradient(circle at 52% 45%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 28%),
    color-mix(in srgb, #050713 88%, var(--accent));
  background-size: 30px 30px, 30px 30px, auto, auto;
}

.cowork-page-active .cowork-graph-header,
.cowork-page-active .cowork-graph-inspector {
  background: rgba(6, 9, 22, 0.82);
}

.cowork-page-active .cowork-graph-header {
  padding: 10px 12px;
}

.cowork-page-active .cowork-graph-stage,
.cowork-page-active .cowork-graph-svg {
  min-height: 0;
}

.cowork-page-active .cowork-create {
  grid-column: 3;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  overflow: hidden;
  padding: 12px;
  border-width: 0 0 1px;
  background: color-mix(in srgb, var(--panel-strong) 78%, var(--bg));
}

.cowork-page-active .cowork-create-copy {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-left: 0;
}

.cowork-page-active .cowork-create-copy p,
.cowork-page-active .cowork-create::before {
  display: none;
}

.cowork-page-active .cowork-create-input {
  gap: 8px;
}

.cowork-page-active .cowork-goal-input {
  min-height: 74px;
  max-height: 110px;
  resize: vertical;
}

.cowork-page-active .cowork-command-strip {
  grid-column: 3;
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
  border-width: 0 0 1px;
  background: color-mix(in srgb, var(--panel-strong) 68%, var(--bg));
}

.cowork-page-active .cowork-message-row,
.cowork-page-active .cowork-task-row {
  grid-template-columns: 1fr;
}

.cowork-page-active .cowork-message-row .button,
.cowork-page-active .cowork-task-row .button {
  width: 100%;
}

.cowork-page-active .cowork-insight-panel {
  grid-column: 3;
  grid-row: 3;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  overflow: auto;
  padding: 12px;
  border-width: 0 0 1px;
  background: color-mix(in srgb, var(--panel-strong) 62%, var(--bg));
}

.cowork-page-active .cowork-insight-panel[hidden] {
  display: none;
}

.cowork-page-active .cowork-final-draft {
  max-height: 92px;
}

.cowork-page-active .cowork-agents-section {
  display: none;
}

.cowork-page-active .cowork-tasks-section {
  grid-column: 3;
  grid-row: 4;
}

.cowork-page-active .cowork-mailbox-section {
  grid-column: 3;
  grid-row: 5;
}

.cowork-page-active .cowork-threads-section {
  grid-column: 3;
  grid-row: 6;
  border-bottom: 0;
}

.cowork-page-active .cowork-tasks-section,
.cowork-page-active .cowork-mailbox-section,
.cowork-page-active .cowork-threads-section {
  display: flex;
  overflow: hidden;
  padding: 12px;
  border-width: 0 0 1px;
  background: color-mix(in srgb, var(--panel-strong) 58%, var(--bg));
}

.cowork-page-active .cowork-session-list,
.cowork-page-active .cowork-chat-list,
.cowork-page-active .cowork-list {
  min-height: 0;
  overflow: auto;
}

.cowork-page-active .cowork-metrics {
  display: none;
}

@media (max-width: 1280px) {
  .cowork-page-active .cowork-modal-body {
    grid-template-columns: minmax(220px, 250px) minmax(360px, 1fr) minmax(300px, 330px);
  }
}

@media (max-width: 1100px) {
  .cowork-page-active .cowork-modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto minmax(420px, 58vh) auto auto auto auto auto;
    overflow: auto;
  }

  .cowork-page-active .cowork-session-pane,
  .cowork-page-active .cowork-detail-header,
  .cowork-page-active .cowork-goal-text,
  .cowork-page-active .cowork-graph-panel,
  .cowork-page-active .cowork-create,
  .cowork-page-active .cowork-command-strip,
  .cowork-page-active .cowork-team-chat,
  .cowork-page-active .cowork-tasks-section,
  .cowork-page-active .cowork-mailbox-section,
  .cowork-page-active .cowork-threads-section,
  .cowork-page-active .cowork-insight-panel {
    grid-column: 1;
    border-width: 0 0 1px;
  }

  .cowork-page-active .cowork-session-pane { grid-row: 1; max-height: 220px; }
  .cowork-page-active .cowork-create { grid-row: 2; }
  .cowork-page-active .cowork-detail-header { grid-row: 3; }
  .cowork-page-active .cowork-goal-text { grid-row: 4; }
  .cowork-page-active .cowork-graph-panel { grid-row: 5; min-height: 420px; }
  .cowork-page-active .cowork-command-strip { grid-row: 6; }
  .cowork-page-active .cowork-insight-panel { grid-row: 7; }
  .cowork-page-active .cowork-team-chat { grid-row: 8; min-height: 320px; }
  .cowork-page-active .cowork-tasks-section { grid-row: 9; min-height: 220px; }
  .cowork-page-active .cowork-mailbox-section { grid-row: 10; min-height: 180px; }
  .cowork-page-active .cowork-threads-section { grid-row: 11; min-height: 160px; }
}

/* ========== Cowork Focused Workspace ========== */
.cowork-page-active .cowork-modal-body {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  padding: 14px;
}

.cowork-page-active .cowork-workspace {
  display: grid !important;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.cowork-page-active .cowork-session-pane {
  display: flex !important;
  grid-column: auto !important;
  grid-row: auto !important;
  gap: 10px;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
}

.cowork-page-active .cowork-pane-header {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.cowork-page-active .cowork-detail-pane {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active .cowork-detail-header {
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 70%, transparent);
}

.cowork-page-active .cowork-active-heading .eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--warning) 36%, var(--border-subtle));
  border-radius: var(--radius-xs);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cowork-page-active .cowork-active-heading h3 {
  max-width: 100%;
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-page-active .cowork-run-controls {
  display: flex !important;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-start;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active .cowork-run-controls .button,
.cowork-page-active .cowork-limit-label {
  min-height: 32px;
  border-radius: var(--radius-sm);
}

.cowork-page-active #cowork-summary-button,
.cowork-page-active #cowork-delete-button {
  display: inline-flex;
}

.cowork-page-active .cowork-goal-text {
  display: block;
  grid-column: 1 !important;
  grid-row: 2 !important;
  max-width: none;
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 58%, transparent);
}

.cowork-page-active .cowork-primary-column {
  display: grid;
  grid-column: 1;
  grid-row: 3;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.cowork-page-active .cowork-graph-panel {
  grid-column: auto !important;
  grid-row: auto !important;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 7%, transparent) 1px, transparent 1px),
    color-mix(in srgb, var(--bg-subtle) 76%, var(--panel-strong));
  background-size: 28px 28px, 28px 28px, auto;
}

.cowork-page-active .cowork-graph-header,
.cowork-page-active .cowork-graph-inspector {
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
}

.cowork-page-active .cowork-graph-header h4 {
  color: var(--text);
}

.cowork-page-active .cowork-graph-stage,
.cowork-page-active .cowork-graph-svg {
  min-height: 0;
}

.cowork-page-active .cowork-team-chat {
  display: none !important;
}

.cowork-page-active .cowork-action-rail {
  display: flex;
  grid-column: 2;
  grid-row: 1 / 4;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.cowork-page-active .cowork-create,
.cowork-page-active .cowork-command-strip,
.cowork-page-active .cowork-insight-panel,
.cowork-page-active .cowork-metrics,
.cowork-page-active .cowork-grid > section {
  grid-column: auto !important;
  grid-row: auto !important;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
  box-shadow: none;
}

.cowork-page-active .cowork-create {
  display: grid;
  gap: 10px;
  overflow: visible;
  padding: 12px;
}

.cowork-page-active .cowork-create-copy {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0;
}

.cowork-page-active .cowork-create-copy p,
.cowork-page-active .cowork-create::before {
  display: none;
}

.cowork-page-active .cowork-create .config-label {
  font-size: 13px;
  font-weight: 750;
}

.cowork-page-active .cowork-goal-input {
  min-height: 76px;
  max-height: 130px;
  resize: vertical;
}

.cowork-page-active .cowork-create-actions {
  justify-content: space-between;
}

.cowork-page-active .cowork-create-actions .config-checkbox-label {
  display: inline-flex;
}

.cowork-page-active .cowork-command-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
}

.cowork-page-active .cowork-message-row,
.cowork-page-active .cowork-task-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.cowork-page-active .cowork-message-row .button,
.cowork-page-active .cowork-task-row .button {
  width: 100%;
}

.cowork-page-active .cowork-insight-panel {
  grid-template-columns: 1fr;
  gap: 10px;
  overflow: visible;
  padding: 12px;
}

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

.cowork-page-active .cowork-metric {
  min-height: 56px;
  padding: 10px;
}

.cowork-page-active .cowork-metric span {
  font-size: 20px;
}

.cowork-page-active .cowork-grid {
  display: flex !important;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.cowork-page-active .cowork-agents-section {
  display: flex;
}

.cowork-page-active .cowork-grid > section {
  display: flex;
  flex: 0 0 auto;
  min-height: 150px;
  max-height: 230px;
  overflow: hidden;
  padding: 12px;
}

.cowork-page-active .cowork-tasks-section {
  min-height: 190px;
  max-height: 300px;
}

.cowork-page-active .cowork-chat-list,
.cowork-page-active .cowork-session-list,
.cowork-page-active .cowork-list {
  min-height: 0;
  overflow: auto;
}

.cowork-page-active .cowork-grid h4 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.cowork-page-active .cowork-grid h4::after {
  display: none;
}

.cowork-page-active .cowork-empty {
  min-height: 44px;
}

@media (max-width: 1320px) {
  .cowork-page-active .cowork-workspace {
    grid-template-columns: minmax(160px, 190px) minmax(0, 1fr);
  }

  .cowork-page-active .cowork-detail-pane {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 310px);
  }
}

@media (max-width: 1100px) {
  .cowork-page-active .cowork-modal-body {
    overflow: auto;
  }

  .cowork-page-active .cowork-workspace,
  .cowork-page-active .cowork-detail-pane,
  .cowork-page-active .cowork-primary-column {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .cowork-page-active .cowork-session-pane,
  .cowork-page-active .cowork-detail-header,
  .cowork-page-active .cowork-goal-text,
  .cowork-page-active .cowork-primary-column,
  .cowork-page-active .cowork-action-rail {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .cowork-page-active .cowork-session-pane {
    max-height: 220px;
  }

  .cowork-page-active .cowork-graph-panel {
    min-height: 420px;
  }

  .cowork-page-active .cowork-team-chat {
    min-height: 320px;
  }

  .cowork-page-active .cowork-action-rail {
    overflow: visible;
  }
}

/* ========== Cowork Responsive Cleanup ========== */
.cowork-page-active .cowork-workspace {
  grid-template-columns: minmax(0, 1fr) !important;
}

.cowork-page-active .cowork-session-pane {
  display: none !important;
}

.cowork-page-active .cowork-detail-pane {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px) !important;
}

.cowork-page-active .cowork-action-rail {
  align-self: stretch;
  overflow-x: hidden;
  padding-right: 2px;
}

.cowork-page-active .cowork-action-rail > * {
  flex: 0 0 auto;
  min-width: 0;
}

.cowork-page-active .cowork-create,
.cowork-page-active .cowork-command-strip,
.cowork-page-active .cowork-insight-panel,
.cowork-page-active .cowork-metrics,
.cowork-page-active .cowork-grid > section,
.cowork-page-active .cowork-detail-header,
.cowork-page-active .cowork-goal-text,
.cowork-page-active .cowork-team-chat,
.cowork-page-active .cowork-graph-panel {
  background-color: color-mix(in srgb, var(--panel-strong) 88%, var(--bg));
}

.cowork-page-active .cowork-create-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
}

.cowork-page-active .cowork-create-actions .button {
  min-width: 104px;
}

.cowork-page-active .cowork-metrics {
  order: 2;
}

.cowork-page-active .cowork-command-strip {
  order: 3;
}

.cowork-page-active .cowork-grid {
  order: 4;
}

.cowork-page-active .cowork-metric {
  overflow: hidden;
}

.cowork-page-active .cowork-metric::after {
  display: none;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-modal-body {
    overflow: auto;
  }

  .cowork-page-active .cowork-detail-pane {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto auto;
    overflow: visible;
  }

  .cowork-page-active .cowork-detail-header,
  .cowork-page-active .cowork-goal-text,
  .cowork-page-active .cowork-primary-column,
  .cowork-page-active .cowork-action-rail {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .cowork-page-active .cowork-primary-column {
    grid-template-rows: minmax(420px, 62vh);
  }

  .cowork-page-active .cowork-action-rail {
    overflow: visible;
  }

  .cowork-page-active .cowork-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cowork-page-active .cowork-grid > section {
    max-height: 260px;
  }
}

@media (max-width: 760px) {
  .cowork-page-active .cowork-grid {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-create-actions {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-create-actions .button {
    width: 100%;
  }
}

/* Unified cowork composer: create a mission when no session is active, otherwise send a team message. */
.cowork-page-active .cowork-detail-pane {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px) !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 12px;
  overflow: hidden;
}

.cowork-page-active .cowork-primary-column {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-height: 0;
}

.cowork-page-active .cowork-action-rail {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-height: 0;
  overflow: auto;
}

.cowork-page-active .cowork-create.cowork-composer {
  display: grid;
  grid-column: 1 / 3 !important;
  grid-row: 2 !important;
  position: relative;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 92%, var(--bg));
}

.cowork-page-active .cowork-composer .cowork-create-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  grid-template-areas:
    "tabs tabs"
    "input send"
    "hidden hidden";
  gap: 8px;
}

.cowork-page-active .cowork-mode-tabs {
  --cowork-mode-indicator-x: 4px;
  --cowork-mode-indicator-w: 0px;
  position: relative;
  display: inline-flex;
  grid-area: tabs;
  justify-self: center;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  gap: 2px;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-subtle) 84%, var(--panel-strong));
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.cowork-page-active .cowork-mode-tabs::before {
  content: "";
  position: absolute;
  inset: 4px auto 4px 0;
  width: var(--cowork-mode-indicator-w);
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 88%, #111827), color-mix(in srgb, var(--cowork-cyan) 72%, var(--accent)));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 26%, transparent);
  transform: translateX(var(--cowork-mode-indicator-x));
  transition:
    transform 260ms cubic-bezier(0.2, 0.9, 0.16, 1),
    width 220ms cubic-bezier(0.2, 0.9, 0.16, 1),
    box-shadow 180ms ease;
  will-change: transform, width;
  pointer-events: none;
}

.cowork-page-active .cowork-mode-tabs[hidden] {
  display: none;
}

.cowork-page-active .cowork-mode-tab {
  position: relative;
  z-index: 1;
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transform: translateY(0);
  transition:
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.cowork-page-active .cowork-mode-tab:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.cowork-page-active .cowork-mode-tab.active {
  color: #fff;
  background: transparent;
  box-shadow: none;
  transform: translateY(-1px);
}

.cowork-page-active .cowork-mode-tab:active {
  transform: translateY(0);
}

.cowork-page-active .cowork-composer .cowork-goal-input {
  grid-area: input;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
  max-height: 200px;
  padding: 14px 18px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 58%, var(--bg-subtle));
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  transition: all var(--transition-base);
}

.cowork-page-active .cowork-composer .cowork-goal-input:focus {
  outline: none;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--panel-strong) 90%, transparent);
  box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-sm);
}

.cowork-page-active .cowork-composer .cowork-goal-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cowork-page-active .cowork-composer .cowork-goal-input::placeholder {
  color: var(--text-subtle);
}

.cowork-page-active .cowork-composer .cowork-mode-label {
  grid-area: hidden;
  grid-template-columns: max-content minmax(180px, 320px);
  width: fit-content;
}

.cowork-page-active .cowork-composer .hidden-control,
.cowork-page-active .cowork-composer .cowork-mode-label[hidden] {
  display: none !important;
}

.cowork-page-active .cowork-composer .cowork-create-actions {
  display: grid;
  grid-area: send;
  grid-template-columns: 1fr;
  align-items: end;
  justify-content: end;
}

.cowork-page-active .cowork-composer .error-text {
  position: absolute;
  left: 12px;
  bottom: 4px;
}

.cowork-page-active .cowork-composer .composer-send {
  grid-column: auto;
  width: 52px;
  min-width: 52px;
  height: 52px;
}

.cowork-page-active .cowork-command-strip,
.cowork-page-active .cowork-task-row {
  display: none !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-detail-pane {
    grid-template-columns: 1fr !important;
    grid-template-rows: minmax(420px, 1fr) auto auto !important;
  }

  .cowork-page-active .cowork-primary-column,
  .cowork-page-active .cowork-action-rail,
  .cowork-page-active .cowork-create.cowork-composer {
    grid-column: 1 !important;
  }

  .cowork-page-active .cowork-action-rail {
    grid-row: 2 !important;
  }

  .cowork-page-active .cowork-create.cowork-composer {
    grid-row: 3 !important;
  }
}

/* Unified cowork status dialog */
.cowork-page-active .cowork-detail-pane {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px) !important;
}

.cowork-page-active .cowork-action-rail {
  overflow: hidden;
  padding-right: 0;
}

.cowork-status-dialog {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 92%, var(--bg));
}

.cowork-status-feed {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.cowork-status-feed-section {
  display: grid;
  gap: 8px;
}

.cowork-status-feed-section h5 {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cowork-status-bubble {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 90%, transparent);
  box-shadow: none;
}

.cowork-status-bubble.overview {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border-subtle));
  background: color-mix(in srgb, var(--accent-soft) 34%, var(--panel-strong));
}

.cowork-status-bubble.from-user {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border-subtle));
  background: color-mix(in srgb, var(--accent-soft) 48%, var(--panel-strong));
}

.cowork-status-bubble.event {
  background: transparent;
  box-shadow: none;
}

.cowork-status-bubble.active,
.cowork-status-bubble[tabindex]:hover,
.cowork-status-bubble[tabindex]:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border-subtle));
  outline: none;
  box-shadow: inset 3px 0 0 var(--accent);
}

.cowork-status-bubble-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cowork-status-bubble strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.3;
}

.cowork-status-bubble p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.cowork-status-bubble small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.cowork-page-active .cowork-metrics,
.cowork-page-active .cowork-grid {
  display: none !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-detail-pane {
    grid-template-columns: 1fr !important;
  }

  .cowork-status-dialog {
    min-height: 360px;
  }
}

/* Cowork observability console */
.cowork-page-active .cowork-detail-pane {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
}

.cowork-page-active .cowork-detail-header {
  display: grid;
  grid-column: 1 !important;
  grid-row: 1 !important;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 90%, var(--bg));
}

.cowork-page-active .cowork-run-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cowork-page-active .cowork-primary-column {
  grid-column: 1 !important;
  grid-row: 2 !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

.cowork-page-active .cowork-action-rail {
  display: none !important;
}

.cowork-page-active .cowork-create.cowork-composer {
  grid-column: 1 !important;
  grid-row: 3 !important;
}

.cowork-page-active .cowork-goal-text,
.cowork-page-active .cowork-observability-grid,
.cowork-page-active .cowork-team-chat {
  display: none !important;
}

.cowork-page-active .cowork-graph-panel {
  min-height: 0;
}

.cowork-page-active .cowork-graph-stage {
  position: relative;
}

.cowork-field-overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(320px, 1fr);
  gap: 10px;
  width: min(720px, calc(100% - 24px));
  max-height: min(42%, 260px);
  pointer-events: auto;
}

.cowork-field-overlay-status,
.cowork-field-flow {
  min-width: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border-subtle));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 86%, transparent);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.cowork-field-overlay-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}

.cowork-field-status-chip {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-subtle) 72%, transparent);
}

.cowork-field-status-chip strong {
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-field-status-chip span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.cowork-field-flow {
  display: grid;
  gap: 8px;
  align-content: start;
}

.cowork-field-flow-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.cowork-field-flow-header strong {
  color: var(--text);
  font-size: 12px;
}

.cowork-field-flow-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-field-flow-item {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-subtle) 60%, transparent);
}

.cowork-field-flow-item strong,
.cowork-field-flow-item p,
.cowork-field-flow-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-field-flow-item strong {
  color: var(--text);
  font-size: 12px;
}

.cowork-field-flow-item p {
  margin: 2px 0;
  color: var(--text);
  font-size: 11px;
}

.cowork-field-flow-item small {
  color: var(--text-muted);
  font-size: 10px;
}

.cowork-observability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.cowork-ops-panel,
.cowork-inspector-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--panel-strong) 90%, var(--bg));
}

.cowork-run-panel {
  grid-column: 1 / -1;
}

.cowork-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.cowork-panel-heading h4 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.cowork-panel-note {
  overflow: hidden;
  max-width: 58%;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-page-active .cowork-compact-metrics {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cowork-projection-list {
  min-height: 0;
  overflow: auto;
}

.cowork-observable-card {
  min-height: 68px;
}

.cowork-observable-card p,
.cowork-observable-card small {
  overflow-wrap: anywhere;
}

.cowork-trace-card {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border-subtle));
  background: color-mix(in srgb, var(--accent-soft) 34%, var(--panel-strong));
}

.cowork-artifact-card {
  border-color: color-mix(in srgb, var(--success) 26%, var(--border-subtle));
  background: color-mix(in srgb, var(--success-soft) 34%, var(--panel-strong));
}

.cowork-filter-select {
  width: 132px;
  min-height: 32px;
  padding: 4px 8px;
}

.cowork-selected-inspector {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.cowork-selected-inspector h5 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.cowork-selected-inspector p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.cowork-selected-inspector details {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.cowork-selected-inspector summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.cowork-selected-inspector pre {
  max-height: 220px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  color: var(--text);
  font-size: 11px;
  white-space: pre-wrap;
}

.cowork-inspector-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.cowork-inspector-row span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.cowork-inspector-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.cowork-task-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, max-content);
  gap: 8px;
}

.cowork-final-draft {
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--bg-subtle);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-detail-pane {
    grid-template-rows: auto auto auto auto !important;
  }

  .cowork-page-active .cowork-detail-header,
  .cowork-page-active .cowork-primary-column,
  .cowork-page-active .cowork-action-rail,
  .cowork-page-active .cowork-create.cowork-composer {
    grid-column: 1 !important;
  }

  .cowork-page-active .cowork-detail-header {
    grid-row: 1 !important;
  }

  .cowork-page-active .cowork-primary-column {
    grid-row: 2 !important;
  }

  .cowork-page-active .cowork-action-rail {
    grid-row: 3 !important;
  }

  .cowork-page-active .cowork-create.cowork-composer {
    grid-row: 4 !important;
  }

  .cowork-page-active .cowork-detail-header {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-run-controls {
    justify-content: flex-start;
  }

  .cowork-page-active .cowork-primary-column {
    grid-template-rows: minmax(320px, 44vh) auto !important;
  }
}

@media (max-width: 760px) {
  .cowork-observability-grid {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-compact-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cowork-task-controls {
    grid-template-columns: 1fr;
  }

  .cowork-task-controls .button {
    width: 100%;
  }

  .cowork-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .cowork-panel-note {
    max-width: 100%;
  }
}

.cowork-page-active .cowork-detail-header {
  display: none !important;
}

/* ========== Cowork Spec Collaboration Workspace ========== */
.cowork-page-active .cowork-modal-body {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.cowork-page-active .cowork-collab-workspace {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}

.cowork-page-active .cowork-session-pane {
  display: none !important;
}

.cowork-page-active .cowork-detail-pane {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) minmax(160px, 0.24fr) auto;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active .cowork-detail-header {
  display: grid !important;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--cowork-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 92%, var(--bg));
}

.cowork-page-active .cowork-goal-text {
  display: none !important;
}

.cowork-page-active .cowork-primary-column {
  display: grid !important;
  position: relative;
  grid-row: 2;
  grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.1fr) minmax(280px, 0.9fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.cowork-page-active .cowork-panel-rail-button {
  position: absolute;
  z-index: 8;
  width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.cowork-page-active .cowork-graph-rail-button {
  top: 12px;
  left: 8px;
}

.cowork-page-active .cowork-trace-rail-button {
  top: 12px;
  right: 8px;
}

.cowork-page-active .cowork-graph-panel,
.cowork-page-active .cowork-conversation-panel,
.cowork-page-active .cowork-observability-grid {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--cowork-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 94%, var(--bg));
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.cowork-page-active .cowork-graph-panel {
  display: grid !important;
  grid-column: 1;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px),
    color-mix(in srgb, var(--bg-subtle) 74%, var(--panel-strong));
  background-size: 24px 24px, 24px 24px, auto;
}

.cowork-page-active .cowork-conversation-panel {
  display: flex !important;
  grid-column: 2;
  flex-direction: column;
  padding: 12px;
}

.cowork-page-active .cowork-conversation-panel h4,
.cowork-page-active .cowork-panel-heading h4,
.cowork-page-active .cowork-graph-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.cowork-page-active .cowork-chat-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 2px 2px;
}

.cowork-page-active .cowork-observability-grid {
  display: grid !important;
  grid-column: 3;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.cowork-secondary-tabs,
.cowork-trace-mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--cowork-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-subtle) 82%, var(--panel-strong));
}

.cowork-secondary-tab,
.cowork-trace-mode-button {
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.cowork-secondary-tab.active,
.cowork-trace-mode-button.active {
  background: var(--surface-dark);
  color: var(--on-dark);
}

[data-theme="dark"] .cowork-secondary-tab.active,
[data-theme="dark"] .cowork-trace-mode-button.active {
  background: color-mix(in srgb, var(--surface-dark-elevated) 70%, var(--accent));
}

.cowork-page-active .cowork-observability-grid > .cowork-ops-panel {
  display: none;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
}

.cowork-page-active #cowork-modal[data-cowork-secondary-tab="trace"] .cowork-ops-panel[data-cowork-panel="trace"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="tasks"] .cowork-ops-panel[data-cowork-panel="tasks"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="mailbox"] .cowork-ops-panel[data-cowork-panel="mailbox"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="outputs"] .cowork-ops-panel[data-cowork-panel="outputs"] {
  display: flex;
}

.cowork-page-active #cowork-modal[data-cowork-secondary-tab="trace"] .cowork-trace-panel {
  display: flex;
}

.cowork-trace-panel {
  flex-direction: column;
  gap: 10px;
}

.cowork-trace-toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.cowork-filter-select {
  width: 96px;
  min-height: 30px;
  padding: 4px 7px;
  border-radius: 8px;
  font-size: 11px;
}

.cowork-trace-group {
  display: grid;
  gap: 10px;
  position: relative;
  padding: 0 0 14px 18px;
}

.cowork-trace-group::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 34px;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, var(--accent) 22%, var(--cowork-line));
}

.cowork-trace-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--cowork-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 96%, var(--bg));
}

.cowork-trace-group-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cowork-trace-group-head strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cowork-trace-group-head span:not(.cowork-status) {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cowork-trace-flow {
  display: grid;
  gap: 8px;
}

.cowork-trace-step {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.cowork-trace-dot {
  width: 8px;
  height: 8px;
  margin-top: 12px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--panel-strong);
}

.cowork-trace-step-body,
.cowork-trace-detail-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--cowork-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 94%, var(--bg));
}

.cowork-trace-step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cowork-trace-step-top strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-trace-step-body small,
.cowork-trace-detail-card small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.cowork-trace-step-body p,
.cowork-trace-detail-card p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cowork-trace-json-block,
.cowork-trace-detail-card pre {
  max-height: 180px;
  margin: 10px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--surface-dark);
  color: var(--on-dark);
  font: 11px/1.5 var(--font-mono);
  white-space: pre-wrap;
}

.cowork-final-output-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--success) 38%, var(--cowork-line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--success-soft) 54%, var(--panel-strong));
}

.cowork-final-output-card strong {
  color: var(--success);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.cowork-final-output-card p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.cowork-chat-blocker {
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--cowork-line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger-soft) 44%, var(--panel-strong));
}

.cowork-page-active .cowork-action-rail {
  display: grid !important;
  grid-row: 3;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.cowork-page-active .cowork-inspector-panel,
.cowork-page-active .cowork-status-dialog {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--cowork-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 92%, var(--bg));
}

.cowork-page-active .cowork-status-feed,
.cowork-page-active .cowork-selected-inspector,
.cowork-page-active .cowork-projection-list {
  min-height: 0;
  overflow: auto;
}

.cowork-page-active .cowork-create.cowork-composer {
  display: grid;
  grid-row: 4;
  padding: 10px 12px;
  border: 1px solid var(--cowork-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 96%, var(--bg));
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-primary-column {
  grid-template-columns: 48px minmax(0, 1fr) minmax(280px, 0.86fr);
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-panel {
  display: grid !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-conversation-panel {
  grid-column: 2;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-observability-grid {
  grid-column: 3;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-primary-column {
  grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.1fr) 48px;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-observability-grid {
  display: grid !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-modal-body {
    overflow: auto;
  }

  .cowork-page-active .cowork-detail-pane {
    grid-template-rows: auto auto auto auto !important;
    overflow: visible;
  }

  .cowork-page-active .cowork-primary-column {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 44vh) minmax(320px, auto) minmax(320px, auto);
    overflow: visible;
  }

  .cowork-page-active .cowork-graph-panel,
  .cowork-page-active .cowork-conversation-panel,
  .cowork-page-active .cowork-observability-grid {
    grid-column: 1 !important;
  }

  .cowork-page-active .cowork-action-rail {
    grid-template-columns: 1fr;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .cowork-page-active .cowork-detail-header {
    grid-template-columns: 1fr;
  }

  .cowork-page-active .cowork-run-controls {
    justify-content: flex-start;
  }

  .cowork-page-active .cowork-composer .cowork-create-input {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tabs"
      "input"
      "send"
      "hidden";
  }

  .cowork-page-active .cowork-composer .composer-send {
    width: 100%;
  }

.cowork-trace-toolbar,
  .cowork-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

.cowork-graph-peer-zone {
  pointer-events: none;
}

.cowork-graph-peer-zone rect {
  fill: color-mix(in srgb, var(--accent-soft) 38%, transparent);
  stroke: color-mix(in srgb, var(--accent) 34%, var(--cowork-line));
  stroke-width: 1.4;
  stroke-dasharray: 6 7;
}

.cowork-graph-peer-title {
  fill: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.cowork-graph-peer-meta {
  fill: var(--text-muted);
  font-size: 11px;
}

/* Final placement pass for the spec-driven graph / conversation / trace surface. */
.cowork-page-active .cowork-detail-pane {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) minmax(150px, 0.24fr) auto !important;
  gap: 12px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.cowork-page-active .cowork-detail-header {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

.cowork-page-active .cowork-primary-column {
  grid-column: 1 !important;
  grid-row: 2 !important;
  height: 100% !important;
  min-height: 0 !important;
}

.cowork-page-active .cowork-action-rail {
  grid-column: 1 !important;
  grid-row: 3 !important;
  min-height: 0 !important;
}

.cowork-page-active .cowork-create.cowork-composer {
  grid-column: 1 !important;
  grid-row: 4 !important;
}

.cowork-page-active .cowork-graph-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

.cowork-page-active .cowork-conversation-panel {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

.cowork-page-active .cowork-observability-grid {
  grid-column: 3 !important;
  grid-row: 1 !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-primary-column {
  grid-template-columns: 48px minmax(0, 1fr) minmax(280px, 0.86fr) !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-panel {
  display: grid !important;
  grid-column: 1 !important;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-panel > :not(.cowork-graph-header) {
  display: none !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-header {
  display: grid;
  place-items: start center;
  padding: 8px;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-controls {
  display: flex !important;
  position: absolute;
  top: 8px;
  left: 7px;
  z-index: 2;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed #cowork-graph-collapse-button {
  display: inline-flex !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-header > div,
.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-controls > button:not(#cowork-graph-collapse-button) {
  display: none !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-conversation-panel {
  grid-column: 2 !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-observability-grid {
  grid-column: 3 !important;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-primary-column {
  grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.1fr) 48px !important;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-observability-grid {
  display: grid !important;
  grid-column: 3 !important;
  min-width: 0;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-secondary-tabs,
.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-observability-grid > .cowork-ops-panel:not(.cowork-trace-panel),
.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-trace-panel #cowork-trace-list,
.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-trace-panel h4,
.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-trace-toolbar > :not(#cowork-trace-collapse-button) {
  display: none !important;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-trace-panel {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-panel-heading {
  padding: 8px;
}

/* Stabilize the spec workspace after older Cowork grid rules. */
.cowork-page-active .cowork-primary-column {
  grid-template-columns: minmax(0, 0.34fr) minmax(0, 0.4fr) minmax(0, 0.26fr) !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.cowork-page-active .cowork-panel-rail-button[hidden] {
  display: none !important;
}

.cowork-page-active .cowork-graph-header {
  min-width: 0 !important;
}

.cowork-page-active .cowork-graph-header > div {
  min-width: 0 !important;
}

.cowork-page-active .cowork-graph-controls {
  flex: 0 0 auto !important;
}

.cowork-page-active .cowork-graph-controls .button {
  min-width: 34px !important;
  padding-inline: 9px !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-primary-column {
  grid-template-columns: 44px minmax(0, 0.66fr) minmax(0, 0.34fr) !important;
}

.cowork-page-active #cowork-modal.cowork-trace-collapsed .cowork-primary-column {
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 0.54fr) 44px !important;
}

.cowork-page-active .cowork-secondary-tabs,
.cowork-page-active .cowork-trace-mode-tabs {
  position: relative !important;
  display: grid !important;
  align-items: center !important;
  align-self: start !important;
  gap: 0 !important;
  overflow: hidden !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  border-color: color-mix(in srgb, var(--accent) 24%, var(--cowork-line)) !important;
  background: color-mix(in srgb, var(--accent-soft) 48%, var(--panel-strong)) !important;
}

.cowork-page-active .cowork-secondary-tabs {
  grid-template-columns: repeat(4, minmax(58px, 1fr)) !important;
  width: min(100%, 252px) !important;
}

.cowork-page-active .cowork-trace-mode-tabs {
  grid-template-columns: repeat(2, minmax(34px, 1fr)) !important;
  width: 78px !important;
}

.cowork-page-active .cowork-secondary-tabs::before,
.cowork-page-active .cowork-trace-mode-tabs::before {
  content: "" !important;
  position: absolute !important;
  z-index: 0 !important;
  top: 3px !important;
  bottom: 3px !important;
  left: 3px !important;
  display: block !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)) !important;
  box-shadow: 0 8px 18px var(--accent-glow) !important;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.cowork-page-active .cowork-secondary-tabs::before {
  width: calc((100% - 6px) / 4) !important;
}

.cowork-page-active .cowork-trace-mode-tabs::before {
  width: calc((100% - 6px) / 2) !important;
}

.cowork-page-active .cowork-secondary-tabs[data-active="tasks"]::before {
  transform: translateX(100%) !important;
}

.cowork-page-active .cowork-secondary-tabs[data-active="mailbox"]::before {
  transform: translateX(200%) !important;
}

.cowork-page-active .cowork-secondary-tabs[data-active="outputs"]::before {
  transform: translateX(300%) !important;
}

.cowork-page-active .cowork-trace-mode-tabs[data-active="detail"]::before {
  transform: translateX(100%) !important;
}

.cowork-page-active .cowork-secondary-tab,
.cowork-page-active .cowork-trace-mode-button {
  position: relative !important;
  z-index: 1 !important;
  min-width: 0 !important;
  min-height: 24px !important;
  padding: 0 9px !important;
  background: transparent !important;
  color: color-mix(in srgb, var(--accent) 70%, var(--text-muted)) !important;
  transition: color 160ms ease, transform 160ms ease !important;
}

.cowork-page-active .cowork-secondary-tab.active,
.cowork-page-active .cowork-trace-mode-button.active {
  background: transparent !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}

@media (prefers-reduced-motion: reduce) {
  .cowork-page-active .cowork-secondary-tabs::before,
  .cowork-page-active .cowork-trace-mode-tabs::before,
  .cowork-page-active .cowork-secondary-tab,
  .cowork-page-active .cowork-trace-mode-button {
    transition: none !important;
  }
}

.cowork-page-active .cowork-observability-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto !important;
  grid-auto-rows: minmax(96px, auto) !important;
  align-content: start !important;
  align-items: start !important;
  gap: 10px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: auto !important;
  padding: 12px !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel-strong) 94%, var(--bg)) !important;
}

.cowork-page-active .cowork-observability-grid::before,
.cowork-page-active .cowork-observability-grid::after {
  content: none !important;
  display: none !important;
}

.cowork-page-active .cowork-secondary-tabs {
  grid-column: 1 !important;
  grid-row: 1 !important;
  align-self: start !important;
  justify-self: start !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
}

.cowork-page-active .cowork-observability-grid > .cowork-ops-panel {
  grid-column: 1 !important;
  grid-row: auto !important;
  min-width: 0 !important;
  min-height: 96px !important;
  max-height: 360px !important;
  overflow: hidden !important;
  padding: 10px !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel-strong) 96%, var(--bg)) !important;
}

.cowork-page-active #cowork-modal[data-cowork-secondary-tab="trace"] .cowork-trace-panel,
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="tasks"] .cowork-ops-panel[data-cowork-panel="tasks"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="mailbox"] .cowork-ops-panel[data-cowork-panel="mailbox"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="outputs"] .cowork-ops-panel[data-cowork-panel="outputs"] {
  display: flex !important;
}

.cowork-page-active .cowork-trace-panel {
  flex-direction: column !important;
  overflow: hidden !important;
}

.cowork-page-active .cowork-trace-panel .cowork-panel-heading {
  flex: 0 0 auto !important;
}

.cowork-page-active #cowork-trace-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}

.cowork-page-active .cowork-panel-heading {
  flex: 0 0 auto !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-panel-heading h4,
.cowork-page-active .cowork-card strong,
.cowork-page-active .cowork-card p,
.cowork-page-active .cowork-card small,
.cowork-page-active .cowork-empty {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
}

.cowork-page-active .cowork-card-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
  gap: 8px !important;
}

.cowork-page-active .cowork-status,
.cowork-page-active .cowork-panel-note {
  max-width: 100% !important;
  white-space: nowrap !important;
}

.cowork-page-active .cowork-projection-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}

/* Cowork shell refresh: keep the three work columns stable and simplify the surrounding chrome. */
.cowork-page-active .cowork-detail-pane {
  grid-template-rows: auto minmax(0, 1fr) auto auto !important;
  gap: 10px !important;
}

.cowork-page-active .cowork-detail-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 11px 14px !important;
  border: 1px solid var(--cowork-line) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel-strong) 96%, var(--bg)) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05) !important;
}

.cowork-page-active .cowork-active-heading {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-areas:
    "status title"
    "goal goal" !important;
  align-items: center !important;
  gap: 5px 10px !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-active-heading .cowork-session-meta {
  grid-area: status !important;
  width: fit-content !important;
  max-width: 260px !important;
  margin: 0 !important;
  padding: 4px 8px !important;
  overflow: hidden !important;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--cowork-line)) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--accent-soft) 46%, var(--panel-strong)) !important;
  color: color-mix(in srgb, var(--accent) 70%, var(--text)) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  text-overflow: ellipsis !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

.cowork-page-active .cowork-active-heading h3 {
  grid-area: title !important;
  min-width: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: var(--text) !important;
  font-size: 17px !important;
  font-weight: 850 !important;
  line-height: 1.25 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.cowork-page-active .cowork-goal-text {
  display: block !important;
  grid-row: 1 !important;
  grid-column: 1 !important;
  grid-area: goal !important;
  max-width: 78ch !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.cowork-page-active .cowork-session-actions {
  justify-content: flex-end !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-session-actions .button {
  min-height: 32px !important;
  padding: 6px 10px !important;
  border-radius: 7px !important;
  font-size: 12px !important;
}

.cowork-page-active .cowork-action-rail {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto !important;
  max-height: 132px !important;
  overflow: hidden !important;
}

.cowork-page-active .cowork-status-dialog {
  display: none !important;
}

.cowork-page-active .cowork-inspector-panel {
  display: grid !important;
  grid-template-columns: minmax(170px, 0.22fr) minmax(0, 1fr) minmax(360px, 0.52fr) !important;
  align-items: stretch !important;
  gap: 10px !important;
  min-height: 0 !important;
  padding: 10px 12px !important;
  overflow: hidden !important;
  border-color: var(--cowork-line) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel-strong) 94%, var(--bg)) !important;
}

.cowork-page-active .cowork-inspector-panel .cowork-panel-heading {
  align-content: start !important;
  align-items: start !important;
  flex-direction: column !important;
  justify-content: start !important;
  gap: 4px !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-inspector-panel .cowork-panel-note {
  max-width: 100% !important;
}

.cowork-page-active .cowork-selected-inspector {
  min-width: 0 !important;
  overflow: auto !important;
}

.cowork-page-active .cowork-selected-inspector h5 {
  font-size: 13px !important;
}

.cowork-page-active .cowork-selected-inspector p,
.cowork-page-active .cowork-inspector-row strong {
  font-size: 11px !important;
}

.cowork-page-active .cowork-task-controls {
  align-self: start !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.7fr) repeat(2, max-content) !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-task-controls .config-input,
.cowork-page-active .cowork-task-controls .config-select,
.cowork-page-active .cowork-task-controls .button {
  min-height: 32px !important;
  font-size: 12px !important;
}

.cowork-page-active .cowork-task-controls #cowork-task-retry-button,
.cowork-page-active .cowork-task-controls #cowork-task-review-button {
  grid-column: auto !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-detail-header {
    grid-template-columns: 1fr !important;
  }

  .cowork-page-active .cowork-session-actions {
    justify-content: flex-start !important;
  }

  .cowork-page-active .cowork-action-rail {
    max-height: none !important;
    overflow: visible !important;
  }

  .cowork-page-active .cowork-inspector-panel {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 760px) {
  .cowork-page-active .cowork-active-heading {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "status"
      "title"
      "goal" !important;
  }

  .cowork-page-active .cowork-active-heading h3,
  .cowork-page-active .cowork-goal-text {
    white-space: normal !important;
  }

  .cowork-page-active .cowork-task-controls {
    grid-template-columns: 1fr 1fr !important;
  }

  .cowork-page-active .cowork-task-controls .config-input,
  .cowork-page-active .cowork-task-controls .config-select {
    grid-column: 1 / -1 !important;
  }
}

/* Focused Cowork console: keep the default swarm surface on outcome, progress, and active work. */
.cowork-page-active .cowork-detail-pane {
  grid-template-rows: auto auto minmax(0, 1fr) minmax(118px, 0.18fr) auto !important;
  gap: 10px !important;
}

.cowork-page-active .cowork-focus-strip {
  grid-column: 1 !important;
  grid-row: 2 !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-focus-strip[hidden] {
  display: none !important;
}

.cowork-page-active .cowork-focus-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 4px;
  min-width: 0;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--cowork-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 96%, var(--bg));
}

.cowork-page-active .cowork-focus-card span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
}

.cowork-page-active .cowork-focus-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-page-active .cowork-focus-card small {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cowork-page-active .cowork-primary-column {
  grid-row: 3 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr) !important;
  gap: 10px !important;
}

.cowork-page-active .cowork-graph-panel {
  display: none !important;
}

.cowork-page-active .cowork-conversation-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
  padding: 12px !important;
  border: 1px solid var(--cowork-line) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel-strong) 97%, var(--bg)) !important;
}

.cowork-page-active .cowork-conversation-panel > h4 {
  margin-bottom: 4px !important;
}

.cowork-page-active .cowork-chat-list {
  padding-right: 2px !important;
}

.cowork-page-active .cowork-chat-event {
  padding: 6px 8px !important;
  background: transparent !important;
}

.cowork-page-active .cowork-observability-grid {
  grid-column: 2 !important;
  grid-row: 1 !important;
  padding: 10px !important;
  gap: 8px !important;
  border: 1px solid var(--cowork-line) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel-strong) 94%, var(--bg)) !important;
}

.cowork-page-active .cowork-run-panel,
.cowork-page-active .cowork-swarm-summary-panel {
  display: flex !important;
  flex-direction: column !important;
  min-height: 88px !important;
  max-height: 190px !important;
}

.cowork-page-active .cowork-run-panel .cowork-filter-input {
  min-height: 30px !important;
  font-size: 11px !important;
}

.cowork-page-active .cowork-compact-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

.cowork-page-active .cowork-metric {
  min-height: 54px !important;
  padding: 8px !important;
}

.cowork-page-active .cowork-metric span {
  font-size: 15px !important;
}

.cowork-page-active .cowork-secondary-tabs {
  width: 100% !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  order: 3 !important;
}

.cowork-page-active .cowork-observability-grid > .cowork-ops-panel {
  max-height: 260px !important;
}

.cowork-page-active #cowork-modal[data-cowork-secondary-tab="tasks"] .cowork-ops-panel[data-cowork-panel="tasks"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="mailbox"] .cowork-ops-panel[data-cowork-panel="mailbox"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="outputs"] .cowork-ops-panel[data-cowork-panel="outputs"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="trace"] .cowork-trace-panel {
  display: flex !important;
}

.cowork-page-active .cowork-action-rail {
  grid-row: 4 !important;
  max-height: 118px !important;
}

.cowork-page-active .cowork-create.cowork-composer {
  grid-row: 5 !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-focus-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .cowork-page-active .cowork-primary-column {
    grid-template-columns: 1fr !important;
  }

  .cowork-page-active .cowork-observability-grid {
    grid-column: 1 !important;
  }
}

@media (max-width: 760px) {
  .cowork-page-active .cowork-focus-strip {
    grid-template-columns: 1fr !important;
  }
}

/* Overlap guard: the focused sidebar is a vertical stack, not a layered grid. */
.cowork-page-active .cowork-observability-grid {
  display: flex !important;
  flex-direction: column !important;
  align-content: stretch !important;
  align-items: stretch !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.cowork-page-active .cowork-observability-grid > .cowork-ops-panel {
  position: static !important;
  grid-column: auto !important;
  grid-row: auto !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  box-sizing: border-box !important;
  display: none !important;
  overflow: hidden !important;
}

.cowork-page-active .cowork-run-panel,
.cowork-page-active .cowork-swarm-summary-panel,
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="tasks"] .cowork-ops-panel[data-cowork-panel="tasks"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="mailbox"] .cowork-ops-panel[data-cowork-panel="mailbox"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="outputs"] .cowork-ops-panel[data-cowork-panel="outputs"],
.cowork-page-active #cowork-modal[data-cowork-secondary-tab="trace"] .cowork-ops-panel[data-cowork-panel="trace"] {
  display: flex !important;
  flex-direction: column !important;
}

.cowork-page-active .cowork-observability-grid .cowork-projection-list {
  flex: 0 1 auto !important;
  min-height: 0 !important;
  max-height: 220px !important;
  overflow: auto !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card,
.cowork-page-active .cowork-observability-grid .cowork-empty {
  min-height: 0 !important;
  box-sizing: border-box !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card-actions {
  position: static !important;
  z-index: auto !important;
  margin-top: 6px !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card-actions .button {
  position: static !important;
}

/* Workflow map is an explicit mode now: no collapsed rail in the focused default view. */
.cowork-page-active #cowork-map-button.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--cowork-line)) !important;
  background: color-mix(in srgb, var(--accent-soft) 66%, var(--panel-strong)) !important;
  color: var(--accent) !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-graph-panel {
  display: none !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-primary-column {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr) !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-conversation-panel {
  grid-column: 1 !important;
}

.cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-observability-grid {
  grid-column: 2 !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-primary-column {
  grid-template-columns: minmax(0, 1fr) !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-panel {
  display: grid !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 12px !important;
  overflow: hidden !important;
  border: 1px solid var(--cowork-line) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel-strong) 96%, var(--bg)) !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-conversation-panel,
.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-observability-grid {
  display: none !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  align-items: start !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-header > div:first-child {
  min-width: 0 !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-header h4,
.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-header p {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-stage {
  min-width: 0 !important;
  min-height: 360px !important;
  overflow: hidden !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-svg {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 1180px) {
  .cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-primary-column,
  .cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-primary-column {
    grid-template-columns: 1fr !important;
  }

  .cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-panel,
  .cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-conversation-panel,
  .cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-observability-grid,
  .cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-conversation-panel,
  .cowork-page-active #cowork-modal.cowork-graph-collapsed .cowork-observability-grid {
    grid-column: 1 !important;
  }
}

/* Compact Cowork session header: keep identity, state, and controls in a shallow band. */
.cowork-page-active .cowork-detail-header {
  min-height: 0 !important;
  padding: 7px 10px !important;
  gap: 8px !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  align-items: center !important;
}

.cowork-page-active .cowork-active-heading {
  display: grid !important;
  grid-template-columns: auto minmax(110px, max-content) minmax(0, 1fr) !important;
  grid-template-areas:
    "status title goal"
    "branches branches branches" !important;
  align-items: center !important;
  gap: 3px 8px !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-active-heading .cowork-session-meta {
  max-width: 180px !important;
  padding: 2px 6px !important;
  font-size: 9px !important;
  line-height: 1.15 !important;
}

.cowork-page-active .cowork-active-heading h3 {
  max-width: 260px !important;
  font-size: 14px !important;
  line-height: 1.1 !important;
}

.cowork-page-active .cowork-goal-text {
  display: block !important;
  max-width: none !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

.cowork-page-active .cowork-branch-list {
  grid-area: branches !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  max-height: 22px !important;
  margin-top: 1px !important;
  overflow: hidden !important;
}

.cowork-page-active .cowork-branch-chip {
  min-height: 20px !important;
  max-width: 180px !important;
  padding: 3px 6px !important;
  gap: 0 !important;
  border-radius: 6px !important;
}

.cowork-page-active .cowork-branch-chip strong {
  font-size: 10px !important;
  line-height: 1.1 !important;
}

.cowork-page-active .cowork-branch-chip span {
  display: none !important;
}

.cowork-page-active .cowork-session-actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 5px !important;
  justify-content: flex-end !important;
}

.cowork-page-active .cowork-session-actions .button {
  min-height: 26px !important;
  padding: 4px 7px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-detail-header {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .cowork-page-active .cowork-session-actions {
    justify-content: flex-start !important;
    overflow-x: auto !important;
  }
}

@media (max-width: 760px) {
  .cowork-page-active .cowork-active-heading {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "status"
      "title"
      "goal"
      "branches" !important;
  }

  .cowork-page-active .cowork-active-heading h3,
  .cowork-page-active .cowork-goal-text {
    max-width: 100% !important;
  }
}

/* Align compact header items on one visual baseline. */
.cowork-page-active .cowork-detail-header {
  padding-block: 6px !important;
  align-items: center !important;
}

.cowork-page-active .cowork-active-heading {
  grid-template-columns: max-content max-content minmax(80px, 1fr) minmax(0, max-content) !important;
  grid-template-areas: "status title goal branches" !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 28px !important;
}

.cowork-page-active .cowork-active-heading .cowork-session-meta,
.cowork-page-active .cowork-active-heading h3,
.cowork-page-active .cowork-goal-text,
.cowork-page-active .cowork-branch-list {
  align-self: center !important;
}

.cowork-page-active .cowork-goal-text {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cowork-page-active .cowork-branch-list {
  max-width: 190px !important;
  max-height: 20px !important;
  margin: 0 !important;
}

.cowork-page-active .cowork-branch-chip {
  min-height: 20px !important;
  align-items: center !important;
}

.cowork-page-active .cowork-session-actions {
  align-items: center !important;
  align-self: center !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-active-heading {
    grid-template-columns: max-content max-content minmax(80px, 1fr) minmax(0, max-content) !important;
    grid-template-areas: "status title goal branches" !important;
  }
}

@media (max-width: 760px) {
  .cowork-page-active .cowork-active-heading {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "status"
      "title"
      "goal"
      "branches" !important;
    align-items: start !important;
  }
}

/* Neutral Cowork list items: avoid colored left-strip cards in dense work panels. */
.cowork-page-active .cowork-observability-grid .cowork-card,
.cowork-page-active .cowork-observability-grid .cowork-observable-card,
.cowork-page-active .cowork-observability-grid .cowork-trace-card,
.cowork-page-active .cowork-observability-grid .cowork-artifact-card {
  min-height: 0 !important;
  padding: 9px 10px !important;
  border: 1px solid color-mix(in srgb, var(--cowork-line) 92%, var(--bg)) !important;
  border-radius: 7px !important;
  background: color-mix(in srgb, var(--panel-strong) 98%, var(--bg)) !important;
  box-shadow: none !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card[tabindex]:hover,
.cowork-page-active .cowork-observability-grid .cowork-card.active,
.cowork-page-active .cowork-observability-grid .cowork-observable-card.active {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--cowork-line)) !important;
  background: color-mix(in srgb, var(--panel-strong) 94%, var(--accent-soft)) !important;
  box-shadow: none !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card-row {
  align-items: center !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card strong {
  font-size: 12px !important;
  font-weight: 760 !important;
  line-height: 1.25 !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card p {
  color: color-mix(in srgb, var(--text-muted) 88%, var(--text)) !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
}

.cowork-page-active .cowork-observability-grid .cowork-card small {
  color: var(--text-muted) !important;
  font-size: 10px !important;
  line-height: 1.3 !important;
}

.cowork-page-active .cowork-observability-grid .cowork-lane-label {
  gap: 0 !important;
  margin: 8px 0 2px !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  font-weight: 780 !important;
  letter-spacing: 0 !important;
  text-transform: uppercase !important;
}

.cowork-page-active .cowork-observability-grid .cowork-lane-label::before {
  display: none !important;
}

/* Header baseline correction: text-only goal should align like the adjacent pills. */
.cowork-page-active .cowork-active-heading .cowork-session-meta,
.cowork-page-active .cowork-active-heading h3,
.cowork-page-active .cowork-goal-text,
.cowork-page-active .cowork-branch-chip {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 20px !important;
  margin-block: 0 !important;
}

.cowork-page-active .cowork-goal-text {
  height: 20px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1 !important;
}

.cowork-page-active .cowork-active-heading {
  align-items: center !important;
}

/* Keep detail tabs visible above variable-height observability content. */
.cowork-page-active .cowork-observability-grid > .cowork-secondary-tabs {
  order: -10 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 3 !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  margin: 0 0 2px !important;
  box-sizing: border-box !important;
  background: color-mix(in srgb, var(--panel-strong) 98%, var(--bg)) !important;
  box-shadow: 0 4px 8px color-mix(in srgb, var(--panel-strong) 90%, transparent) !important;
}

.cowork-page-active .cowork-observability-grid > .cowork-run-panel,
.cowork-page-active .cowork-observability-grid > .cowork-swarm-summary-panel {
  order: 0 !important;
}

.cowork-page-active .cowork-observability-grid > .cowork-ops-panel[data-cowork-panel] {
  order: 1 !important;
}

/* Trace panel: keep controls stable and let dense All mode scroll instead of compressing. */
.cowork-page-active .cowork-trace-panel {
  min-height: 260px !important;
  max-height: min(46vh, 430px) !important;
  gap: 8px !important;
}

.cowork-page-active .cowork-trace-panel .cowork-panel-heading {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  align-items: center !important;
  gap: 8px !important;
}

.cowork-page-active .cowork-trace-toolbar {
  display: grid !important;
  grid-template-columns: max-content minmax(76px, 1fr) 28px !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: 6px !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

.cowork-page-active .cowork-trace-mode-tabs {
  width: 76px !important;
  min-width: 76px !important;
}

.cowork-page-active .cowork-trace-mode-tabs::before {
  transition:
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 160ms ease,
    box-shadow 160ms ease !important;
  will-change: transform !important;
}

.cowork-page-active .cowork-trace-mode-button {
  transition:
    color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease !important;
}

.cowork-page-active .cowork-trace-mode-button:hover {
  opacity: 0.84 !important;
}

.cowork-page-active .cowork-trace-mode-button.active {
  transform: translateY(-1px) scale(1.02) !important;
}

.cowork-page-active .cowork-trace-panel .cowork-filter-select {
  width: 100% !important;
  min-width: 0 !important;
}

.cowork-page-active .cowork-trace-panel #cowork-trace-collapse-button {
  width: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
}

.cowork-page-active #cowork-trace-list {
  flex: 1 1 auto !important;
  min-height: 170px !important;
  max-height: none !important;
  padding-right: 3px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.cowork-page-active #cowork-trace-list .cowork-card,
.cowork-page-active #cowork-trace-list .cowork-trace-step-body,
.cowork-page-active #cowork-trace-list .cowork-trace-detail-card {
  overflow: visible !important;
}

.cowork-page-active #cowork-trace-list .cowork-card-row,
.cowork-page-active #cowork-trace-list .cowork-trace-step-top {
  grid-template-columns: minmax(0, 1fr) max-content !important;
  min-width: 0 !important;
}

.cowork-page-active #cowork-trace-list .cowork-card p,
.cowork-page-active #cowork-trace-list .cowork-card small,
.cowork-page-active #cowork-trace-list .cowork-trace-step-body p,
.cowork-page-active #cowork-trace-list .cowork-trace-step-body small {
  overflow-wrap: anywhere !important;
}

@media (max-width: 1180px) {
  .cowork-page-active .cowork-trace-panel .cowork-panel-heading {
    grid-template-columns: 1fr !important;
    align-items: start !important;
  }

  .cowork-page-active .cowork-trace-toolbar {
    grid-template-columns: max-content minmax(92px, 1fr) 28px !important;
    width: 100% !important;
  }
}

/* Cowork page uses the session header as the primary header; remove the outer marketing-style bar. */
.cowork-page-active .cowork-page-header {
  display: none !important;
}

.cowork-page-active .cowork-modal-content {
  grid-template-rows: minmax(0, 1fr) !important;
}

.cowork-page-active .cowork-modal-body {
  grid-row: 1 !important;
}

/* The right detail panes already expose selected trace/task content; keep advanced task actions out of the default flow. */
.cowork-page-active .cowork-action-rail {
  display: none !important;
}

.cowork-page-active .cowork-detail-pane {
  grid-template-rows: auto auto minmax(0, 1fr) auto !important;
}

.cowork-page-active .cowork-create.cowork-composer {
  grid-row: 4 !important;
}

/* Collapse affordances were removed; hide stale controls if cached markup is present. */
.cowork-page-active #cowork-graph-collapse-button,
.cowork-page-active #cowork-trace-collapse-button,
.cowork-page-active .cowork-graph-rail-button,
.cowork-page-active .cowork-trace-rail-button {
  display: none !important;
}

/* Cowork console polish: keep the map and operational details visible together on desktop. */
.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-primary-column {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-graph-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-height: 0 !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-conversation-panel {
  display: none !important;
}

.cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-observability-grid {
  display: flex !important;
  grid-column: 2 !important;
  grid-row: 1 !important;
}

.cowork-page-active .cowork-graph-stage,
.cowork-page-active .cowork-graph-svg {
  min-height: 0 !important;
}

.cowork-page-active .cowork-focus-card {
  min-height: 74px !important;
}

.cowork-page-active .cowork-composer .cowork-goal-input {
  min-height: 44px !important;
}

@media (max-width: 1180px) {
  .cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-primary-column {
    grid-template-columns: 1fr !important;
    grid-template-rows: minmax(360px, 54vh) auto !important;
  }

  .cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-observability-grid {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }
}

@media (max-width: 760px) {
  .cowork-page-active #cowork-modal:not(.cowork-graph-collapsed) .cowork-primary-column {
    grid-template-rows: minmax(280px, 44vh) auto !important;
  }

  .cowork-page-active .cowork-secondary-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .cowork-page-active .cowork-secondary-tabs::before {
    display: none !important;
  }

  .cowork-page-active .cowork-secondary-tab.active {
    background: color-mix(in srgb, var(--accent-soft) 76%, var(--panel-strong)) !important;
    color: var(--text) !important;
  }
}
