:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --panel: #171b20;
  --panel-2: #1d2329;
  --text: #f4f6f8;
  --muted: #9aa5b1;
  --line: #2d3540;
  --green: #57d68d;
  --blue: #62a8ff;
  --amber: #f4bf50;
  --red: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.section-head,
.task-row,
.artifact,
.event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.primary {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--green);
  color: #07100b;
  font-weight: 800;
  cursor: pointer;
}

.secondary {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary:disabled,
.secondary:disabled {
  cursor: wait;
  opacity: 0.6;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.bottom-grid {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  margin-top: 16px;
}

.command-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.profile-help {
  display: grid;
  grid-template-columns: minmax(220px, 0.6fr) minmax(0, 1.4fr);
  gap: 16px;
  margin-bottom: 16px;
}

.profile-help ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.profile-help code {
  color: var(--green);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
}

.manual-panel {
  margin-bottom: 16px;
}

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

.manual-task-form input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}

.chat-panel,
.source-panel {
  min-height: 280px;
}

.chat-messages {
  display: grid;
  align-content: end;
  gap: 10px;
  min-height: 160px;
  max-height: 260px;
  overflow: auto;
  margin-bottom: 12px;
}

.chat-message {
  max-width: 84%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.chat-message.user {
  justify-self: end;
  border-color: rgba(87, 214, 141, 0.45);
}

.chat-role {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty-chat {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
}

.chat-form,
.source-form {
  display: grid;
  gap: 10px;
}

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

.chat-form input,
.source-form input,
.source-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

.source-form textarea {
  resize: vertical;
  min-height: 110px;
}

.source-status {
  min-height: 18px;
  margin-top: 10px;
}

.section-head {
  margin-bottom: 16px;
}

.badge,
.tool,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.running,
.status.running {
  color: #06100b;
  background: var(--green);
}

.badge.waiting_for_approval {
  color: #171003;
  background: var(--amber);
}

.status.completed {
  color: #06100b;
  background: var(--green);
}

.status.pending {
  color: #171003;
  background: var(--amber);
}

.status.failed {
  color: #160707;
  background: var(--red);
}

.task-list,
.memory-list,
.event-feed {
  display: grid;
  gap: 10px;
}

.task-row {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
}

.task-row.done {
  border-color: rgba(87, 214, 141, 0.55);
}

.task-title {
  margin-bottom: 4px;
  font-weight: 800;
}

.task-notes,
.subtle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

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

.checklist {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.integration {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
}

.integration strong {
  display: block;
  margin-bottom: 6px;
}

.integration .mode {
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.check-item {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.integration.live .mode {
  color: var(--green);
}

.lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.lanes.empty {
  grid-template-columns: 1fr;
}

.agent-process-panel {
  margin-top: 16px;
}

.agent-processes {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 10px;
}

.agent-process {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
}

.agent-process.running {
  border-color: rgba(87, 214, 141, 0.7);
}

.agent-process-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.agent-name {
  font-size: 13px;
  font-weight: 800;
}

.agent-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.agent-metrics span {
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #11161b;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lane {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 14px;
}

.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.lanes-done {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cancel-btn {
  padding: 3px 10px;
  border: 1px solid var(--red);
  border-radius: 4px;
  background: transparent;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.cancel-btn:hover {
  background: var(--red);
  color: var(--bg);
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.tool {
  min-height: 22px;
  padding: 0 8px;
  color: var(--blue);
}

.stage {
  margin: 12px 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.artifact {
  align-items: flex-start;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}

.artifact > div {
  width: 100%;
}

.artifact-title {
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 800;
}

.warning {
  margin-top: 6px;
  color: var(--amber);
  font-size: 12px;
}

.recording-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}

.recording-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--green);
  background: var(--panel-2);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.recording-link:hover {
  filter: brightness(1.1);
}

.memory-matches {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.memory-match {
  border-left: 3px solid var(--blue);
  padding: 6px 0 6px 10px;
}

.memory-match-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}

.artifact-output {
  white-space: pre-wrap;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1318;
  color: var(--text);
  padding: 8px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.candidate-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.candidate {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12171d;
  padding: 12px;
}

.candidate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.candidate p {
  margin: 8px 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.availability,
.next-action {
  margin-top: 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.next-action {
  border-left: 3px solid var(--amber);
  padding-left: 10px;
}

.artifact-details {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.artifact-details summary {
  cursor: pointer;
  font-weight: 800;
}

.artifact-details a {
  display: inline-block;
  margin-top: 8px;
  color: var(--green);
  text-decoration: none;
}

/* Retained for older artifacts; live browser iframes are intentionally hidden from the main demo UI. */
.browser-live {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050608;
}

.browser-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.browser-live-head a {
  color: var(--green);
  text-decoration: none;
}

.browser-live iframe {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
  background: white;
}

.event-feed {
  max-height: 360px;
  overflow: auto;
}

.event-row {
  align-items: flex-start;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.event-type {
  flex: 0 0 155px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.event-time {
  color: var(--muted);
  font-size: 12px;
}

.memory-item {
  border-left: 3px solid var(--blue);
  padding: 7px 0 7px 10px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .topbar,
  .grid,
  .bottom-grid,
  .profile-help,
  .lanes,
  .agent-processes {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .primary {
    width: 100%;
  }

  .actions {
    display: grid;
    width: 100%;
  }

  .secondary {
    width: 100%;
  }

  .manual-task-form {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }
}
