:root {
  --bg: #090f17;
  --bg-2: #0d1520;
  --surface: #111b28;
  --surface-2: #152232;
  --surface-3: #0f1925;
  --ink: #e8f0f7;
  --muted: #95a9bc;
  --line: #24374a;
  --line-soft: #1d2d3d;
  --brand: #39b8ff;
  --brand-2: #2683d1;
  --ok: #57d29a;
  --warn: #ff8378;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 8% 8%, rgba(57, 184, 255, 0.24) 0, transparent 30%),
    radial-gradient(circle at 90% 12%, rgba(92, 145, 255, 0.18) 0, transparent 34%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 62%, #0a1119 100%);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: linear-gradient(rgba(173, 201, 221, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(173, 201, 221, 0.07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at center, black 24%, transparent 90%);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1520px;
  margin: 0 auto;
  padding: 18px 14px 56px;
  display: grid;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}

.hero {
  padding: 16px 18px;
}

.eyebrow {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7ec6ff;
}

.hero h1 {
  margin: 7px 0 2px;
  font-size: clamp(1.8rem, 2.7vw, 2.5rem);
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.column-left,
.column-right {
  display: grid;
  gap: 14px;
}

.section {
  padding: 12px;
}

.section.narrow {
  position: static;
}

.section-title-wrap h2,
.section-title-row h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-title-wrap p,
.section-title-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.shortcut-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 9px;
  margin: 0 0 10px;
  color: #abc2d4;
  font-size: 0.76rem;
}

.stack {
  display: grid;
  gap: 8px;
}

.inbox-scroll {
  max-height: 62vh;
  overflow: auto;
  padding-right: 2px;
}

.agent-row,
.inbox-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(170deg, var(--surface-3), #0f1925);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.inbox-card {
  outline: none;
}

.inbox-card.is-active,
.inbox-card:focus-visible {
  border-color: #47beff;
  box-shadow: 0 0 0 2px rgba(71, 190, 255, 0.24);
}

.agent-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.agent-edit-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.agent-name {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.agent-metric {
  font-size: 0.86rem;
  color: #d0deea;
}

.agent-metric b {
  color: #91cdff;
}

.agent-label {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  font-size: 0.66rem;
  color: #8fa8bc;
  letter-spacing: 0.05em;
}

.agent-value {
  font-size: 0.9rem;
}

.status.success {
  color: var(--ok);
}

.status.error {
  color: var(--warn);
}

.run-logs {
  margin-top: 8px;
  border-top: 1px dashed var(--line-soft);
  padding-top: 8px;
}

.run-logs > summary,
details > summary {
  cursor: pointer;
  color: #9ad4ff;
  font-weight: 500;
}

.log-body {
  margin-top: 7px;
  display: grid;
  gap: 7px;
}

.inline-kv {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  font-size: 0.83rem;
}

.inline-kv span b {
  color: #acc1d3;
  font-weight: 500;
}

.log-actions {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 0.84rem;
  color: #d0deea;
}

pre {
  margin: 0;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0b1520;
  color: #dbe7f2;
  font-size: 0.79rem;
  white-space: pre-wrap;
}

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

.item-meta {
  display: grid;
  gap: 2px;
}

.item-id {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  color: #7f97ab;
  text-transform: uppercase;
}

.item-agent {
  font-size: 0.78rem;
  color: #9fbed5;
}

.source-link {
  color: #82c9ff;
  text-decoration: none;
  font-size: 0.8rem;
  word-break: break-all;
}

.source-link:hover {
  text-decoration: underline;
}

label {
  display: grid;
  gap: 5px;
  font-size: 0.88rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid #31475a;
  border-radius: 10px;
  padding: 8px 10px;
  background: #0b1622;
  color: var(--ink);
  font-family: inherit;
}

textarea {
  resize: vertical;
}

textarea[readonly] {
  background: #09131d;
  border-color: #2a3f52;
  color: #d1e3f1;
}

input::placeholder,
textarea::placeholder {
  color: #7890a2;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 2px solid rgba(57, 184, 255, 0.26);
}

.evidence-list {
  margin: 8px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.evidence-list li {
  padding: 7px 9px;
  border-left: 2px solid var(--brand);
  border-radius: 7px;
  background: #102233;
  color: #d5e8f8;
  font-size: 0.83rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 11px;
  font-family: inherit;
  font-weight: 700;
  color: #031420;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.66;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #172431;
  color: #c8d9e8;
  border-color: #325066;
}

.btn-danger {
  background: #34181d;
  color: #ffb2ad;
  border-color: #6c3540;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 9, 13, 0.76);
  z-index: 15;
  padding: 10px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(760px, 100%);
  padding: 14px;
}

.modal.compact {
  width: min(420px, 100%);
}

.form-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-stack {
  display: grid;
  gap: 6px;
}

code {
  background: #0a1621;
  border: 1px solid #284052;
  border-radius: 6px;
  padding: 1px 4px;
}

kbd {
  display: inline-block;
  border: 1px solid #34576f;
  border-bottom-color: #234154;
  border-radius: 6px;
  padding: 1px 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.71rem;
  line-height: 1.35;
  color: #d8eeff;
  background: #0e202d;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(12px);
  background: #102938;
  color: #d2f1ff;
  border: 1px solid #2f6c8e;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  opacity: 0;
  transition: all 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

  .section.narrow {
    position: static;
  }

  .inbox-scroll {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 12px 10px 36px;
  }

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

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

  .section-title-row {
    align-items: flex-start;
  }
}
