:root {
  --bg: #f2efe8;
  --panel: #fffdf8;
  --panel-alt: #f8f4ea;
  --line: #d9cfbd;
  --text: #1f2328;
  --muted: #6d6456;
  --accent: #1f6f5f;
  --accent-soft: #d9ede7;
  --warning: #aa6a00;
  --warning-soft: #fff0cc;
  --danger: #a12f2f;
  --danger-soft: #fde4e4;
  --success: #2d6a4f;
  --success-soft: #dff3e8;
  --shadow: 0 12px 30px rgba(54, 40, 18, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31, 111, 95, 0.12), transparent 24%),
    linear-gradient(180deg, #fbf9f3 0%, var(--bg) 100%);
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar-summary {
  min-width: 0;
  justify-self: center;
  text-align: center;
}

.topbar-summary-eyebrow {
  margin: 0 0 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
}

.topbar-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  list-style: none;
}

.topbar-summary-grid > div {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 0.78rem;
}

.topbar-summary-grid dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.topbar-summary-grid dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.board-row-token-stats {
  margin: 0;
}

.board-remove-feature {
  align-self: flex-start;
}

.board-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.board-feature-summary {
  flex: 1 1 280px;
  max-width: 520px;
  padding: 12px 16px;
}

.board-feature-summary-eyebrow {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-feature-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
}

.board-feature-summary-grid > div {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 0.82rem;
}

.board-feature-summary-grid dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.board-feature-summary-grid dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.topbar h1,
.section-header h2,
.section-header h3,
.panel h2,
.panel h3,
.empty-state h2 {
  margin: 0;
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.03em;
}

.subtitle,
.section-header p,
.panel p,
.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-status {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ghost-button,
.primary-button,
.artifact-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: white;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

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

.run-workspace {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
  gap: 20px;
  align-items: start;
  min-height: calc(100vh - 140px);
}

.run-workspace-primary {
  min-width: 0;
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
}

.run-output-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 88px;
}

.run-output-header {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.run-output-header h2 {
  font-size: 1.05rem;
  margin: 4px 0 0;
}

.run-output-content {
  flex: 1 1 auto;
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f1419;
  color: #e7ecf3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 320px;
}

.pipeline-board {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
  overflow: auto;
  background: #e8e4dc;
  border-radius: 16px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line, #ddd6c8);
}

.pipeline-board-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.pipeline-board-header .eyebrow {
  margin: 0;
}

.pipeline-board-header h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.pipeline-board-subtitle {
  margin: 6px 0 0;
}

.pipeline-board-subtitle.hidden {
  display: none;
}

.pipeline-grid {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.run-feature-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.run-flow-card {
  border-radius: 14px;
  padding: 14px 16px 18px;
  background: #fffdf8;
  border: 1px solid var(--line, #ddd6c8);
}

.run-flow-card-task {
  background: #ece8e0;
}

.run-flow-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 1rem;
  border-bottom: silver solid 1px;
}

.run-flow-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.run-flow-card-title-placeholder {
  display: block;
  min-height: 0;
  padding: 0;
}

.run-flow-card-stats {
  text-align: right;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #5c574f;
  white-space: nowrap;
}

.run-flow-card-stats span {
  display: block;
}

.run-flow-track {
  --run-flow-avatar-size: 36px;
  --run-flow-labels-height: 2.35rem;
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  padding-left: 4px;
}

.run-flow-agent-block,
.run-flow-check-block {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-width: 0;
}

.run-flow-agent-labels {
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: flex-end;
  gap: 2px;
  min-height: var(--run-flow-labels-height);
  margin-bottom: 6px;
}

.run-flow-agent-labels-spacer {
  visibility: hidden;
  margin-bottom: 6px;
}

.run-flow-agent-lane {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex: 0 0 auto;
}

.run-flow-check-lane {
  align-items: center;
  padding-left: 6px;
}

.run-flow-agent {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  width: var(--run-flow-avatar-size);
  flex-shrink: 0;
}

.run-flow-agent:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 4px;
  border-radius: 8px;
}

.run-flow-agent-selected .run-flow-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563eb;
}

.run-flow-agent-name {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-flow-agent-id {
  font-size: 0.65rem;
  color: #6b6560;
  text-align: center;
}

.run-flow-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--run-flow-avatar-size);
  height: var(--run-flow-avatar-size);
  border-radius: 50%;
  border: 3px solid #5a5a5a;
  background: #fff;
  box-sizing: border-box;
}

.run-flow-avatar-inner {
  font-size: 1.35rem;
  line-height: 1;
}

.run-flow-avatar.status-pending {
  border-color: #5a5a5a;
  opacity: 0.85;
}

.run-flow-agent-block:has(.run-flow-avatar.status-pending) .run-flow-agent-name,
.run-flow-agent-block:has(.run-flow-avatar.status-pending) .run-flow-agent-id,
.run-flow-agent-block:has(.run-flow-avatar.status-pending) .run-flow-avatar-inner {
  opacity: 0.45;
}

.run-flow-avatar.status-progress {
  border-color: #2563eb;
  animation: run-flow-pulse 1.6s ease-in-out infinite;
}

.run-flow-avatar.status-complete {
  border-color: #16a34a;
}

.run-flow-avatar.status-failed {
  border-color: #dc2626;
}

.run-flow-avatar.status-paused {
  border-color: #ea580c;
  animation: run-flow-pulse 2s ease-in-out infinite;
}

.run-flow-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 76px;
  flex-shrink: 0;
  padding: 0 2px 0 4px;
}

.run-flow-segment-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--run-flow-avatar-size);
  width: 100%;
}

.run-flow-dashes {
  display: flex;
  gap: 5px;
  align-items: center;
}

.run-flow-dash {
  display: block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: #5a5a5a;
}

.run-flow-dash.status-pending {
  background: #5a5a5a;
}

.run-flow-dash.status-progress {
  background: #2563eb;
  animation: run-flow-pulse 1.6s ease-in-out infinite;
}

.run-flow-dash.status-complete {
  background: #16a34a;
}

.run-flow-dash.status-failed {
  background: #dc2626;
}

.run-flow-dash.status-paused {
  background: #ea580c;
}

.run-flow-segment-stats {
  margin: 4px 0 0;
  font-size: 0.62rem;
  line-height: 1.35;
  color: #5c574f;
  text-align: center;
  white-space: nowrap;
}

.run-flow-segment-stats span {
  display: block;
}

.run-flow-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--run-flow-avatar-size);
  height: var(--run-flow-avatar-size);
  border-radius: 50%;
  border: 3px solid #5a5a5a;
  font-size: 1.25rem;
  font-weight: 700;
  color: #5a5a5a;
  background: #fff;
  box-sizing: border-box;
}

.run-flow-check.status-complete {
  border-color: #16a34a;
  color: #16a34a;
}

@keyframes run-flow-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.pipeline-grid-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(100%, 720px);
}

.pipeline-grid-header,
.pipeline-grid-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) repeat(3, minmax(88px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.pipeline-grid-head-agent,
.pipeline-grid-head-cell {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 4px 8px;
}

.pipeline-grid-agent {
  border: 2px solid #b8b2a5;
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  font-size: 0.88rem;
}

.pipeline-grid-agent .agent-id {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

.pipeline-grid-cell {
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  font-size: 0.68rem;
  background: white;
  border: 2px solid #e5e2db;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}

.pipeline-stage-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  line-height: 1.2;
}

.pipeline-stat {
  display: block;
  font-variant-numeric: tabular-nums;
  color: #3d3830;
}

.pipeline-stat-label {
  color: var(--muted);
  font-weight: 600;
  margin-right: 4px;
  text-transform: lowercase;
}

.pipeline-stat-model {
  font-size: 0.62rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.pipeline-grid-agent {
  cursor: pointer;
}

.pipeline-grid-agent:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pipeline-grid-agent-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.pipeline-grid-agent.status-disabled,
.pipeline-grid-cell.status-disabled { opacity: 0.55; border-color: #b8b2a5; }
.pipeline-grid-agent.status-waiting,
.pipeline-grid-cell.status-waiting { border-color: var(--warning); background: #fffaf0; }
.pipeline-grid-agent.status-completed,
.pipeline-grid-cell.status-completed { border-color: var(--success); background: var(--success-soft); }
.pipeline-grid-agent.status-active,
.pipeline-grid-cell.status-active { border-color: #2563eb; background: #eff6ff; }
.pipeline-grid-agent.status-failed,
.pipeline-grid-cell.status-failed { border-color: var(--danger); background: var(--danger-soft); }

.workspace-summary-panel {
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(150px, 10%) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
}

.sidebar,
.board-area,
.detail-area {
  min-width: 0;
}

.board-area {
  width: 100%;
}

.sidebar-panel.fixed-panel {
  position: sticky;
  top: 18px;
}

.panel,
.empty-state,
.board-column {
  background: var(--panel);
  border: 1px solid rgba(217, 207, 189, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.compact-panel {
  background: var(--panel-alt);
}

.stacked-form,
.stack-list {
  display: grid;
  gap: 12px;
}

.stacked-form label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

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

.summary-grid dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-grid dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.board-columns {
  width: 100%;
}

.board-unified {
  --board-grid-columns: repeat(7, minmax(200px, 1fr));
  border: 1px solid var(--border, var(--line));
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.9);
  overflow: auto;
  max-height: min(70vh, 720px);
}

.board-unified-header-row {
  display: grid;
  grid-template-columns: var(--board-grid-columns);
  position: sticky;
  top: 0;
  z-index: 2;
}

.board-unified-head-cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, var(--line));
  border-right: 1px solid var(--border, var(--line));
  background: rgba(255, 253, 248, 0.98);
  font-weight: 700;
}

.board-unified-head-cell:last-child {
  border-right: none;
}

.board-unified-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.board-unified-rows {
  min-width: min-content;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.board-feature-row {
  display: grid;
  grid-template-columns: var(--board-grid-columns);
  border: 1px solid var(--border, var(--line));
  border-radius: 14px;
  background: #ebe6dc;
  min-height: 132px;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.board-feature-row-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.board-feature-row-empty {
  grid-template-columns: 1fr;
  padding: 16px;
  background: transparent;
  border: none;
}

.board-row-identity {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  border-right: 1px solid var(--border, var(--line));
  min-width: 0;
  min-height: 100%;
  cursor: default;
  background: rgba(255, 253, 248, 0.35);
}

.board-row-identity-feature {
  cursor: pointer;
}

.board-row-identity-feature.selected {
  background: rgba(255, 253, 248, 0.72);
}

.board-row-identity-task {
  justify-content: flex-end;
  background: rgba(255, 253, 248, 0.35);
}

.board-row-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.board-row-description-panel {
  flex: 1;
  min-height: 4.5rem;
  padding: 12px;
  border-radius: 10px;
  background: #c9c4bb;
  box-sizing: border-box;
}

.board-row-description {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: #3d3830;
}

.board-row-actions {
  margin-top: auto;
}

.board-row-cell {
  padding: 12px 10px;
  border-right: 1px solid var(--border, var(--line));
  min-width: 0;
  vertical-align: top;
  background: rgba(255, 253, 248, 0.2);
}

.board-row-cell:last-child {
  border-right: none;
}

.board-row-cell-tasks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.board-task-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  background: #e8e4dc;
  padding: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.board-task-card:hover,
.board-task-card.selected {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(31, 111, 95, 0.2);
}

.board-task-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.board-task-card-header {
  margin: 0;
  padding: 10px 12px;
  background: #9a948a;
  text-align: center;
}

.board-task-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1a1814;
  -webkit-line-clamp: 2;
}

.board-task-card-body {
  display: flex;
  align-items: stretch;
  min-height: 72px;
  background: #ddd8cf;
}

.board-task-card-main {
  flex: 1 1 72%;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 12px;
  box-sizing: border-box;
}

.board-task-card-details {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #3d3830;
  -webkit-line-clamp: 3;
}

.board-task-agents {
  flex: 0 0 28%;
  max-width: 32%;
  border-left: 2px solid #1a1814;
  padding: 8px 8px 10px;
  box-sizing: border-box;
  font-size: 0.62rem;
  text-transform: lowercase;
  background: rgba(0, 0, 0, 0.03);
}

.board-task-agents-label {
  display: block;
  color: #4a453c;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.board-task-agents-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.board-task-agent-chip {
  display: block;
  min-height: 14px;
  padding: 4px 6px;
  border-radius: 3px;
  background: #f7f4ee;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.58rem;
  line-height: 1.15;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-task-agent-chip-empty {
  min-height: 18px;
  background: #f0ece4;
  border-style: dashed;
  color: transparent;
}

.board-column {
  padding: 14px;
  background: rgba(255, 253, 248, 0.9);
  min-width: 0;
  width: 100%;
}

.board-column-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.board-column-header span {
  color: var(--muted);
  font-size: 0.85rem;
}

.card-title-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.card-body-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.board-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.board-card-button {
  min-height: 44px;
  padding: 8px 14px;
}

.board-card-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.board-details-dialog {
  max-width: 520px;
}

.board-details-body {
  padding: 0 20px 12px;
  max-height: 60vh;
  overflow: auto;
}

.board-details-task-stats {
  margin: 0 0 16px;
  padding: 12px 14px;
}

.board-details-task-stats .board-feature-summary-grid {
  margin-top: 8px;
}

.board-details-footer {
  padding: 12px 20px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.board-details-agents-status {
  flex: 1 1 100%;
  margin: 0;
  text-align: right;
}

.board-details-agents-status.is-error {
  color: var(--danger, #e85d5d);
}

.board-details-agent-editor {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}

.board-details-agent-editor h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.board-details-agent-editor-hint {
  margin: 0 0 12px;
}

.board-details-agent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.board-details-agent-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}

.board-details-agent-list li.is-selected {
  border-color: var(--accent, #6ea8fe);
  background: rgba(110, 168, 254, 0.08);
}

.board-details-agent-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
}

.board-details-agent-list .agent-id {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.75rem;
  color: var(--muted);
}

.board-details-dl {
  margin: 0;
}

.board-details-row {
  margin-bottom: 12px;
}

.board-details-row dt {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.board-details-row dd {
  margin: 4px 0 0;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.9rem;
  word-break: break-word;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.task-card:hover,
.task-card.selected {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.task-card-top,
.task-card-meta,
.run-switcher,
.summary-strip,
.artifact-meta,
.list-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.task-card h3 {
  margin: 0;
  font-size: 1rem;
}

.task-card p,
.run-button p,
.timeline-node p,
.artifact-card p,
.list-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-priority { background: #ece7ff; color: #4c3475; }
.badge-run-completed { background: var(--success-soft); color: var(--success); }
.badge-run-running { background: var(--accent-soft); color: var(--accent); }
.badge-run-paused { background: var(--warning-soft); color: var(--warning); }
.badge-run-failed, .badge-seam { background: var(--danger-soft); color: var(--danger); }
.badge-run-none { background: #ececec; color: #5a5a5a; }

.task-card-footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hidden {
  display: none;
}

.form-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--warning-soft, rgba(255, 99, 99, 0.12));
  color: var(--warning, #d64545);
  font-size: 0.82rem;
}

.empty-state {
  padding: 28px;
  min-height: 240px;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-state.active {
  display: flex;
}

.run-button {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  text-align: left;
}

.run-button.selected {
  border-color: var(--accent);
  background: #fcfffe;
}

.summary-strip {
  flex-wrap: wrap;
  margin-top: 14px;
}

.summary-item {
  min-width: 140px;
}

.summary-item strong,
.panel strong {
  display: block;
  margin-bottom: 4px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-node,
.artifact-card,
.list-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: white;
}

.timeline-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
}

.timeline-node.active { border-color: var(--accent); background: var(--accent-soft); }
.timeline-node.blocked { border-color: var(--warning); background: #fffaf0; }
.timeline-node.failed { border-color: var(--danger); background: var(--danger-soft); }
.timeline-node.pending { border-color: #b8b2a5; background: #f5f2ed; }

.timeline-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.timeline-status.completed { background: var(--success); border-color: var(--success); }
.timeline-status.active { background: var(--accent); border-color: var(--accent); }
.timeline-status.not-reached { background: #f5f2ed; border-color: #b8b2a5; }
.timeline-status.fail { background: var(--danger); border-color: var(--danger); }

.timeline-node .list-row-head {
  width: 100%;
}

.timeline-node strong {
  font-size: 0.76rem;
  line-height: 1.3;
}

.two-column-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.artifact-list {
  display: grid;
  gap: 12px;
}

.artifact-meta {
  margin: 10px 0;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px;
  z-index: 1;
}

.modal-dialog-wide {
  width: min(920px, calc(100vw - 32px));
}

.feature-modal-dialog {
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feature-modal-dialog .modal-header {
  flex: 0 0 auto;
}

.feature-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 20px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.feature-modal-compose {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.feature-modal-agents {
  min-height: 0;
  overflow-y: auto;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.feature-description-label {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
}

.feature-description-label textarea {
  min-height: 120px;
  max-height: min(42vh, 380px);
  resize: vertical;
}

.feature-modal-compose-actions {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.feature-modal-agents h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.create-agent-dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.create-agent-dialog .modal-header {
  flex: 0 0 auto;
  padding: 20px 20px 12px;
  margin: 0;
}

.create-agent-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 20px 20px;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.create-agent-body label.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.create-agent-mode {
  margin: 4px 0 0;
}

.create-agent-mode input[type='checkbox'] {
  width: auto;
}

.create-agent-mode-label {
  flex: 1;
  line-height: 1.35;
}

.create-agent-scenario-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.create-agent-scenario-section.hidden {
  display: none;
}

.create-agent-dedicated-note {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
  line-height: 1.45;
}

.create-agent-dedicated-note.hidden {
  display: none;
}

.create-agent-scenario-section select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.scenario-purpose-brief {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.agent-order-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 6px;
}

.agent-order-item.is-new {
  font-weight: 600;
  color: var(--accent, #6ea8fe);
}

.agent-order-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-order-slot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.agent-order-nav {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel, #111);
  color: inherit;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.agent-order-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.agent-order-position {
  flex: 1;
  min-width: 160px;
  font-size: 0.9rem;
}

.agent-order-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.agent-order-slot {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.agent-order-slot.is-active {
  border-color: var(--accent, #6ea8fe);
  background: rgba(110, 168, 254, 0.15);
}

.create-agent-actions {
  display: flex;
  justify-content: flex-end;
}

.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  width: 100%;
}

.toggle-row input[type='checkbox'] {
  flex: 0 0 auto;
  margin: 0;
  width: 18px;
  height: 18px;
}

.agent-toggle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.agent-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.agent-toggle-row.is-disabled {
  opacity: 0.5;
}

.agent-toggle-row label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.agent-toggle-row .toggle-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.agent-toggle-row .toggle-status.on {
  color: var(--accent);
}

.agent-toggle-row input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

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

.small-text {
  font-size: 0.82rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding: 12px 18px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(217, 207, 189, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
}

.brand-subtitle {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.mode-banner {
  margin: 0 0 24px;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.mode-banner-server {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.mode-banner-remote {
  background: rgba(56, 189, 248, 0.12);
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  text-align: center;
}

.remote-board-link-wrap {
  margin-top: 1rem;
  font-size: 0.9rem;
  word-break: break-all;
}

.remote-board-link-wrap a {
  color: #7dd3fc;
}

.mode-banner-demo {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
}

.nav-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(31, 111, 95, 0.3);
}

.page-shell {
  width: 100%;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

.landing-panel {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.chat-container {
  width: min(680px, 100%);
}

.chat-panel-shell {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--panel-alt);
  border: 1px solid rgba(217, 207, 189, 0.8);
  border-radius: 18px;
  min-height: 220px;
  align-content: center;
}

.chat-panel-shell:not(.active) {
  justify-items: center;
}

.chat-message-list {
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.chat-message {
  display: flex;
  width: 100%;
}

.chat-message span {
  display: inline-block;
  max-width: 85%;
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.45;
}

.chat-agent span {
  background: white;
  border: 1px solid var(--line);
}

.chat-user {
  justify-content: flex-end;
}

.chat-user span {
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid rgba(31, 111, 95, 0.18);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.chat-init-button {
  justify-self: center;
  width: 250px;
}

.feature-entry-panel {
  margin-top: 20px;
}

.feature-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 12px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.hero-card {
  padding: 28px 30px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero-card h1,
.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero-copy {
  max-width: 760px;
  margin: 14px 0 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.card-grid,
.main-grid,
.config-grid {
  display: grid;
  gap: 18px;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.config-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.check-list,
.config-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .pipeline-board {
    grid-template-columns: 1fr;
  }

  .feature-modal-body {
    grid-template-columns: 1fr;
  }

  .feature-modal-agents {
    border-left: none;
    padding-left: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    max-height: min(36vh, 320px);
  }

  .two-column-panel {
    grid-template-columns: 1fr;
  }

  .card-grid,
  .main-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }

  .run-workspace {
    grid-template-columns: 1fr;
  }

  .run-output-panel {
    position: static;
    max-height: none;
    min-height: 360px;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-nav {
    width: 100%;
  }

  .nav-tab,
  .primary-button,
  .ghost-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}