:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #66758a;
  --line: #dbe3ee;
  --blue: #2563eb;
  --teal: #0f766e;
  --green: #12805c;
  --amber: #a15c00;
  --red: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
}

.sidebar {
  min-height: 100vh;
  padding: 22px 18px;
  background: #111827;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #34d399;
  color: #06261f;
  font-weight: 900;
}

h1, h2, h3, p { margin: 0; letter-spacing: 0; }
h1 { font-size: 18px; }
h2 { font-size: 24px; }
h3 { font-size: 17px; }
p { color: #7b8aa0; line-height: 1.5; }
.brand p { color: #9ca3af; font-size: 12px; margin-top: 2px; }

nav { display: grid; gap: 6px; }
nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}
nav a.active { color: white; background: rgba(255, 255, 255, 0.12); }

.sidebar-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-card span { color: #a7b0c0; font-size: 12px; }
.sidebar-card strong { color: #d1fae5; font-size: 13px; line-height: 1.4; }

.workspace {
  padding: 22px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.topbar, .hero, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.hero, .grid, .panel {
  scroll-margin-top: 18px;
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
}

.actions { display: flex; gap: 10px; align-items: center; }

input, textarea {
  font: inherit;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
}
input { width: 220px; height: 38px; padding: 0 10px; }

.service-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #bbf7d0;
  font-size: 13px;
  font-weight: 800;
}

button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--blue);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
button:hover { background: #1d4ed8; }

.hero {
  padding: 22px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: center;
}

.eyebrow, .panel-kicker {
  display: block;
  color: var(--teal);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 7px;
}

.hero h3 {
  max-width: 780px;
  font-size: 25px;
  line-height: 1.25;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metric {
  padding: 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.metric strong { font-size: 26px; }

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  gap: 16px;
}

.panel { padding: 16px; }
.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.badge, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e8eef8;
  color: #42526b;
  font-size: 12px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 154px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.agent-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.agent, .task, .event {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfcfe;
}

.agent { padding: 13px; }
.agent-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 900;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.task-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.task {
  padding: 14px;
  border-left: 4px solid #94a3b8;
}
.task.done { border-left-color: var(--green); }
.task.running { border-left-color: var(--amber); }
.task.error { border-left-color: var(--red); }

.pill.done { background: #dcfce7; color: #166534; }
.pill.running { background: #fef3c7; color: #92400e; }
.pill.error { background: #fee2e2; color: #991b1b; }
.pill.queued, .pill.waiting_workers { background: #dbeafe; color: #1e40af; }

.event-list { display: grid; gap: 8px; }
.event { padding: 11px 12px; }

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0 0;
  color: #344055;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 160px;
  overflow: auto;
}

.empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
}

@media (max-width: 940px) {
  body { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  nav { grid-template-columns: repeat(4, 1fr); }
  .hero, .grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .workspace { padding: 12px; }
  .actions { width: 100%; flex-direction: column; align-items: stretch; }
  input, button, .service-chip { width: 100%; justify-content: center; }
  .metric-grid { grid-template-columns: 1fr; }
  nav { grid-template-columns: 1fr 1fr; }
}
