:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5b6472;
  --line: #d9e1ec;
  --paper: #f8fafc;
  --panel: #ffffff;
  --blue: #1555c0;
  --blue-2: #e8f0ff;
  --green: #0d8b62;
  --green-2: #e6f6ef;
  --orange: #f26b21;
  --orange-2: #fff0e6;
  --purple: #6246c7;
  --purple-2: #f0edff;
  --red: #bf2e36;
  --red-2: #fff0f1;
  --shadow: 0 24px 80px rgba(26, 37, 64, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(21, 85, 192, 0.09), transparent 34%),
    linear-gradient(315deg, rgba(13, 139, 98, 0.08), transparent 38%),
    var(--paper);
  color: var(--ink);
}

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

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

button {
  min-height: 42px;
  cursor: pointer;
  font-weight: 750;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

button:hover {
  border-color: #9cb0cc;
  transform: translateY(-1px);
}

.shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.command-center {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 14px;
  min-height: calc(100vh - 36px);
}

.control-rail,
.observability,
.runway {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.panel,
.runway-header,
.stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 38px rgba(30, 48, 84, 0.08);
}

.panel {
  padding: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 6px 8px;
}

.mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--orange-2);
  color: var(--orange);
  font-weight: 900;
}

.icon.green {
  background: var(--green-2);
  color: var(--green);
}

.icon.blue {
  background: var(--blue-2);
  color: var(--blue);
}

.icon.purple {
  background: var(--purple-2);
  color: var(--purple);
}

.icon.red {
  background: var(--red-2);
  color: var(--red);
}

label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

select {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  padding: 0 12px;
}

input,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.microcopy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 14px;
  padding: 4px;
  border-radius: var(--radius);
  background: #eef3f8;
}

.segmented button {
  min-height: 36px;
  border: 0;
  background: transparent;
  font-size: 0.78rem;
}

.segmented button.is-active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 4px 12px rgba(24, 52, 88, 0.1);
}

.slider-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

output {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

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

.switch-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.88rem;
}

.switch-list input {
  accent-color: var(--green);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 0.62fr 0.62fr;
  gap: 8px;
}

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

.runway-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.runway-header h2 {
  margin-bottom: 8px;
  font-size: clamp(1.65rem, 3vw, 3.25rem);
  line-height: 1;
}

.runway-header p:last-child {
  max-width: 850px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.status-card {
  display: grid;
  min-width: 150px;
  place-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  text-align: center;
}

.status-card strong {
  font-size: 2.25rem;
  line-height: 1;
}

.status-card span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.section-label,
.side-heading {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.section-label span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.section-label strong,
.side-heading h2 {
  display: block;
  margin: 0;
  font-size: 1rem;
}

.section-label p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.side-heading {
  padding: 14px;
}

.mission-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 14px;
  align-items: stretch;
}

.mission-panel,
.runtime-panel {
  min-height: 530px;
}

.mission-form {
  display: grid;
  gap: 12px;
}

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

.artifact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef2f7;
}

.artifact-toolbar strong,
.artifact-toolbar span {
  display: block;
}

.artifact-toolbar span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.artifact-toolbar button {
  min-width: 76px;
}

.artifact-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f2f6fb;
}

.artifact-tabs button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
}

.artifact-tabs button.is-active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 3px 10px rgba(24, 52, 88, 0.1);
}

.artifact-output {
  min-height: 220px;
  max-height: 420px;
  margin-top: 10px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.artifact-pane:not(.is-active) {
  display: none;
}

.artifact-output h3 {
  color: var(--ink);
  font-size: 1rem;
}

.artifact-output ul,
.artifact-output ol {
  padding-left: 20px;
}

.artifact-output li {
  margin-bottom: 6px;
}

.table-wrap {
  width: 100%;
  margin: 10px 0 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.artifact-output table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.82rem;
}

.artifact-output th,
.artifact-output td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
}

.artifact-output th {
  background: #f2f6fb;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.artifact-output tr:last-child td {
  border-bottom: 0;
}

.data-grid {
  display: grid;
  gap: 12px;
}

.data-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.data-card strong {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  color: var(--ink);
  font-size: 0.82rem;
}

.data-card pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  color: #263244;
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.trace-table {
  overflow-x: auto;
}

.trace-table table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

.trace-table th,
.trace-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
}

.trace-table th {
  color: var(--ink);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.status-dot {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.status-dot.done {
  background: var(--green-2);
  color: var(--green);
}

.status-dot.running,
.status-dot.queued {
  background: var(--blue-2);
  color: var(--blue);
}

.status-dot.failed {
  background: var(--red-2);
  color: var(--red);
}

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

.source-card {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: #fff;
}

.source-card strong,
.source-card span {
  display: block;
}

.source-card strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.source-card span {
  margin-top: 8px;
  font-size: 0.78rem;
}

.source-card.live {
  border-left-color: var(--green);
}

.source-card.limited {
  border-left-color: var(--orange);
}

.source-card.offline {
  border-left-color: var(--muted);
}

.source-note,
.empty-panel {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.empty-panel {
  display: grid;
  min-height: 150px;
  place-items: center;
  margin: 0;
  border: 1px dashed #c9d5e5;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.runtime-status {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
  margin-bottom: 12px;
}

.runtime-status div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
}

.runtime-status span,
.scratchpad strong {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.runtime-status strong {
  display: block;
  line-height: 1.25;
}

.architecture-flow {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.flow-node {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.flow-node span:first-child {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: #edf2f7;
  color: var(--muted);
  font-weight: 900;
}

.flow-node strong,
.flow-node small {
  display: block;
}

.flow-node small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.flow-node em {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
}

.flow-node.is-running {
  border-color: var(--purple);
  background: var(--purple-2);
}

.flow-node.is-running span:first-child {
  background: var(--purple);
  color: #fff;
}

.flow-node.is-done {
  border-color: rgba(13, 139, 98, 0.35);
  background: var(--green-2);
}

.flow-node.is-done em {
  background: #fff;
  color: var(--green);
}

.scratchpad {
  min-height: 160px;
  max-height: 260px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101827;
  color: #d9e6f6;
  font-size: 0.84rem;
  line-height: 1.5;
}

.scratchpad p {
  margin-bottom: 8px;
}

.scratchpad code {
  color: #a7f3d0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--blue-2);
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 850;
}

.loop-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.stage {
  min-height: 146px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.stage::after {
  content: "";
  position: absolute;
  inset: auto 14px 12px 14px;
  height: 4px;
  border-radius: 999px;
  background: #e9eef5;
}

.stage.is-current {
  border-color: var(--blue);
  background: var(--blue-2);
}

.stage.is-done {
  border-color: rgba(13, 139, 98, 0.35);
  background: var(--green-2);
}

.stage.is-current::after,
.stage.is-done::after {
  background: currentColor;
  color: var(--blue);
}

.stage.is-done::after {
  color: var(--green);
}

.stage span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 900;
}

.stage p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.fleet-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 14px;
}

.orchestrator-core {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 90px;
  padding: 14px;
  border-radius: var(--radius);
  background: #f8fbff;
}

.orchestrator-core span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.pulse-ring {
  width: 54px;
  height: 54px;
  border: 10px solid var(--blue-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  transition: transform 240ms ease;
}

.is-running .pulse-ring {
  animation: spin 1.1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.handoff-strip,
.agent-list,
.memory-list,
.check-list,
.guardrails {
  display: grid;
  gap: 9px;
}

.handoff-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.handoff-chip,
.memory-item,
.check-item,
.guardrail {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.handoff-chip {
  min-height: 52px;
}

.agent {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  position: relative;
  overflow: hidden;
}

.agent-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--purple-2);
  color: var(--purple);
  font-weight: 900;
}

.agent-avatar::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 3px;
  border-radius: 50%;
  background: #b9c3d2;
}

.agent strong,
.agent span {
  display: block;
}

.agent span,
.agent small {
  color: var(--muted);
  font-size: 0.78rem;
}

.agent small {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2f7;
  font-weight: 850;
}

.agent.is-active {
  border-color: var(--purple);
  background: var(--purple-2);
  box-shadow: 0 0 0 3px rgba(98, 70, 199, 0.13);
  transform: translateY(-1px);
}

.agent.is-done small,
.check-item.pass {
  background: var(--green-2);
  color: var(--green);
}

.agent.is-active .agent-avatar {
  background: var(--purple);
  color: #fff;
}

.agent.is-active .agent-avatar::after {
  background: #77f0c5;
  box-shadow: 0 0 0 0 rgba(119, 240, 197, 0.8);
  animation: beacon 1.2s ease-out infinite;
}

.agent-progress {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.agent-progress div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--green));
  transition: width 260ms ease;
}

.agent.is-active .agent-progress div {
  background-size: 180% 100%;
  animation: workbar 1s linear infinite;
}

@keyframes beacon {
  70% {
    box-shadow: 0 0 0 8px rgba(119, 240, 197, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(119, 240, 197, 0);
  }
}

@keyframes workbar {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 180% 50%;
  }
}

.agent.is-risk small,
.check-item.warn {
  background: var(--orange-2);
  color: var(--orange);
}

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

#meterFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--green));
  transition: width 240ms ease;
}

.check-list {
  margin-top: 14px;
}

.check-item {
  display: flex;
  justify-content: space-between;
}

.decision {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: #f5f7fb;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
}

.memory-item strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border-bottom: 1px solid #eef2f7;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric:last-child {
  border-bottom: 0;
}

.metric strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.guardrail {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guardrail span:last-child {
  font-weight: 900;
}

.trace-panel {
  min-height: 350px;
  flex: 1;
}

.trace-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
  margin: 0;
  padding-left: 20px;
  overflow: auto;
}

.trace-log li {
  padding: 8px 8px 8px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.trace-log strong {
  color: var(--ink);
}

@media (max-width: 1180px) {
  .command-center {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .observability {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 0.8fr 1fr 1.2fr;
  }

  .trace-panel {
    min-height: auto;
  }
}

@media (max-width: 860px) {
  .shell {
    padding: 10px;
  }

  .command-center,
  .fleet-grid,
  .observability,
  .mission-workbench,
  .runtime-status {
    grid-template-columns: 1fr;
  }

  .runway-header {
    flex-direction: column;
  }

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

  .handoff-strip {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 520px) {
  .loop-map,
  .artifact-tabs,
  .actions {
    grid-template-columns: 1fr;
  }

  .agent {
    grid-template-columns: 38px 1fr;
  }

  .agent small {
    grid-column: 1 / -1;
    width: fit-content;
  }
}
