:root {
  color-scheme: dark;
  --ink: #f2efe7;
  --muted: #a9b0a3;
  --subtle: #687064;
  --paper: #10140f;
  --panel: #171c15;
  --panel-2: #1f251c;
  --line: #354031;
  --green: #87d37c;
  --mint: #74e0c0;
  --amber: #f2b84b;
  --red: #ff6d61;
  --blue: #75a9ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(135, 211, 124, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(135, 211, 124, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 14% 8%, rgba(116, 224, 192, 0.13), transparent 26rem),
    radial-gradient(circle at 90% 20%, rgba(242, 184, 75, 0.10), transparent 28rem),
    var(--paper);
  background-size: 46px 46px, 46px 46px, auto, auto, auto;
}

button,
a,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--mint);
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.4rem, 5vw, 6.3rem);
  line-height: 0.86;
  max-width: 980px;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 3.8rem);
  line-height: 0.96;
}

h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.top-actions a,
button,
.button-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(31, 37, 28, 0.86);
  padding: 9px 13px;
  cursor: pointer;
}

.top-actions a:hover,
button:hover,
.button-link:hover {
  border-color: var(--mint);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
}

.auth-strip {
  display: grid;
  grid-template-columns: auto minmax(220px, 420px) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 15, 0.72);
}

.auth-strip label,
.auth-strip span {
  color: var(--muted);
  font: 700 12px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.auth-strip input {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(10, 13, 9, 0.72);
  padding: 9px 10px;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 320px;
  gap: 16px;
  padding-top: 18px;
  min-width: 0;
}

.rail,
.detail,
.board,
.mission,
.split,
.task-strip,
.score-grid,
.role-list,
.stack,
.run-list {
  min-width: 0;
  max-width: 100%;
}

.rail {
  position: sticky;
  top: 18px;
  align-self: start;
}

.rail-head,
.role,
.item,
.task,
.deploy,
.risk {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 28, 21, 0.82);
}

.rail-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  color: var(--muted);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(135, 211, 124, 0.5);
  animation: ping 1.8s infinite;
}

@keyframes ping {
  70% {
    box-shadow: 0 0 0 10px rgba(135, 211, 124, 0);
  }
}

.role-list,
.stack {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.role,
.item,
.deploy,
.risk {
  padding: 12px;
  min-width: 0;
  max-width: 100%;
}

.role strong,
.item strong,
.deploy strong,
.risk strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.role span,
.item span,
.deploy span,
.risk span {
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.mission,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 15, 0.88);
  box-shadow: var(--shadow);
}

.mission {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 20px;
  min-height: 190px;
}

.mission > *,
.panel > *,
.panel-head > *,
.control-form > * {
  min-width: 0;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 10px;
}

.score-grid div {
  border-left: 2px solid var(--mint);
  padding: 8px 10px;
  background: rgba(116, 224, 192, 0.06);
}

.score-grid strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.score-grid span {
  color: var(--muted);
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.task-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.task {
  position: relative;
  min-height: 142px;
  padding: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.task::after {
  content: "";
  position: absolute;
  inset: auto 12px 12px 12px;
  height: 3px;
  background: var(--line);
}

.task.done::after {
  background: var(--green);
}

.task.in_progress::after {
  background: var(--amber);
}

.task .id {
  color: var(--mint);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.task strong {
  display: block;
  margin-top: 8px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.task p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.control-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto;
  gap: 8px;
  margin-top: 12px;
  min-width: 0;
  max-width: 100%;
}

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

.control-form input {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(10, 13, 9, 0.72);
  padding: 9px 10px;
  outline: none;
}

.control-form select {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(10, 13, 9, 0.72);
  padding: 9px 10px;
}

.control-form input:focus {
  border-color: var(--mint);
}

.mini-action {
  position: absolute;
  right: 10px;
  bottom: 22px;
  min-height: 28px;
  padding: 5px 8px;
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.item {
  position: relative;
  padding-bottom: 46px;
}

.item .mini-action {
  bottom: 10px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 16px;
}

.panel {
  padding: 14px;
  min-width: 0;
  max-width: 100%;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
}

.timeline {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  max-height: 650px;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  padding-right: 4px;
}

.event {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 13px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(53, 64, 49, 0.9);
  border-radius: 8px;
  background: rgba(31, 37, 28, 0.66);
}

.event .stamp {
  color: var(--subtle);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.event strong {
  display: block;
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}

.event p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.badge.done,
.badge.online {
  color: var(--green);
  border-color: rgba(135, 211, 124, 0.5);
}

.badge.in_progress,
.badge.running,
.badge.pending {
  color: var(--amber);
  border-color: rgba(242, 184, 75, 0.5);
}

.badge.medium {
  color: var(--blue);
  border-color: rgba(117, 169, 255, 0.5);
}

.badge.high,
.badge.approval_required,
.badge.failed,
.badge.timed_out,
.badge.output_pruned {
  color: var(--red);
  border-color: rgba(255, 109, 97, 0.5);
}

.badge.low,
.badge.preapproved,
.badge.completed {
  color: var(--green);
  border-color: rgba(135, 211, 124, 0.5);
}

.deploy-stack {
  margin-top: 14px;
}

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

.policy-strip,
.run-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  margin-top: 10px;
}

.policy-strip span:first-child {
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.run-filters select {
  min-width: min(220px, 100%);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(10, 13, 9, 0.72);
  padding: 9px 10px;
}

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

.run {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 28, 21, 0.82);
}

.run.selected {
  border-color: rgba(116, 224, 192, 0.72);
  background: rgba(31, 37, 28, 0.96);
}

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

.run span {
  margin-top: 6px;
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.run .hint {
  color: var(--amber);
}

.run pre {
  min-width: 0;
  max-width: 100%;
  max-height: 160px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-action {
  margin-top: 8px;
  min-height: 30px;
  padding: 6px 9px;
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.empty {
  width: 100%;
  min-width: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.run-detail {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.detail-head strong,
.detail-head span {
  display: block;
}

.detail-head span {
  margin-top: 5px;
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.diagnostic-strip,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.diagnostic-strip span,
.failure-hint {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--muted);
  background: rgba(10, 13, 9, 0.36);
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.failure-hint {
  color: var(--amber);
}

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

.output-grid section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(10, 13, 9, 0.36);
}

.output-grid strong {
  display: block;
  margin-bottom: 8px;
}

.output-grid pre {
  min-width: 0;
  max-height: 220px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

  .detail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

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

@media (max-width: 820px) {
  .shell {
    padding: 14px;
  }

  .topbar,
  .auth-strip,
  .mission,
  .split,
  .detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    align-items: start;
  }

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

  .rail {
    position: static;
  }

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

  .task-strip {
    grid-template-columns: minmax(0, 1fr);
  }

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

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

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

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

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

  .panel,
  .timeline,
  .event,
    .control-form,
    .run-filters,
    .run-detail,
    .output-grid,
    .run,
  .item,
  .deploy,
  .risk,
  .role,
  .task {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}
