@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap");
:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: #12161e;
  --line: #252b36;
  --muted: #858e9e;
  --text: #e9edf4;
  --lime: #c0ef79;
  --orange: #f1bd72;
}
* {
  box-sizing: border-box;
}
html {
  overflow-y: scroll;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px "DM Sans",
    system-ui,
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
  border: 0;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 4px;
}
input:focus,
select:focus {
  outline: 1px solid var(--lime);
}
.sidebar {
  width: 244px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #10131a;
  border-right: 1px solid var(--line);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  --brand-orange: #f59a45;
  text-decoration: none;
  color: #fafafa;
  font:
    bold 20px "Space Grotesk",
    sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.7px;
}
.brand-name {
  white-space: nowrap;
}
.brand-secondary {
  font-weight: 400;
  color: #a2aab7;
}
.brand-initial {
  color: var(--brand-orange);
}
.brand-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  background-color: var(--brand-orange);
  -webkit-mask: url('/static/ad_icon.webp') center / contain no-repeat;
  mask: url('/static/ad_icon.webp') center / contain no-repeat;
}
.server small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
.nav-label {
  font-size: 9px;
  letter-spacing: 1.6px;
  color: #687284;
  margin: 5px 12px -12px;
}
nav {
  display: grid;
  gap: 6px;
}
nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  padding: 12px;
  border-radius: 7px;
  text-align: left;
  color: #9ca5b6;
  font-size: 12px;
}
nav button.selected {
  background: #202a20;
  color: var(--lime);
}
nav button > b {
  margin-left: auto;
  background: #303b2c;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.server {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.dot.amber {
  background: var(--orange);
}
main {
  margin-left: 244px;
}
header {
  height: 72px;
  border-bottom: 1px solid #1c222d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  font-size: 11px;
  color: #8993a3;
}
.slash {
  margin: 0 15px;
  color: #444d5c;
}
#breadcrumb {
  color: #d3dae6;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}
.header-actions form {
  margin: 0;
}
.header-actions .secondary {
  padding: 6px 9px;
}
.readonly-badge {
  font: 10px monospace;
  color: var(--orange);
  border: 1px solid #59472d;
  background: #211c15;
  border-radius: 5px;
  padding: 6px 9px;
}
.content {
  max-width: 1600px;
  margin: auto;
  padding: 38px 40px 20px;
}
.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--lime);
  font-weight: 600;
}
h1 {
  font:
    500 36px "Space Grotesk",
    sans-serif;
  letter-spacing: -1.5px;
  margin: 10px 0;
}
.accent {
  color: var(--lime);
}
.heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.secondary {
  background: #1b212b;
  border: 1px solid #343d4b;
  border-radius: 7px;
  padding: 11px 14px;
  font-size: 11px;
}
.secondary:hover {
  border-color: #7a915e;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #11151c;
  margin-bottom: 35px;
}
.stat {
  padding: 20px 23px;
  border-right: 1px solid var(--line);
}
.stat:last-child {
  border: 0;
}
.stat-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}
.stat-value {
  font:
    500 30px "Space Grotesk",
    sans-serif;
  margin-top: 10px;
}
.stat-value small {
  font:
    10px "DM Sans",
    sans-serif;
  margin-left: 10px;
  color: #727f90;
}
.green {
  color: var(--lime);
}
.amber {
  color: var(--orange);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
h2 {
  font:
    500 17px "Space Grotesk",
    sans-serif;
  margin: 0;
}
.section-heading h2 span {
  font: 10px monospace;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #a2acbb;
  margin-left: 6px;
}
.muted {
  color: var(--muted);
}
.live-label {
  font-size: 10px;
}
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.search {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10141b;
  padding: 0 12px;
}
.search span {
  font-size: 23px;
  color: #818c9d;
}
.search input {
  border: 0;
  background: transparent;
  min-width: 0;
  width: 100%;
  padding: 11px 0;
  font-size: 11px;
  color: var(--text);
}
select {
  background: #12171f;
  color: #aeb7c7;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 7px;
  font-size: 11px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 20px;
  transition:
    transform 0.15s,
    border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-2px);
  border-color: #5d6c4c;
}
.card.running:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--lime), transparent);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.agent-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #232c27;
  border: 1px solid #344038;
  color: #c7e4ac;
  font: 16px monospace;
}
.card:nth-child(3n + 2) .agent-icon {
  background: #282438;
  border-color: #3c3550;
  color: #bbacf0;
}
.card:nth-child(3n) .agent-icon {
  background: #1d2c36;
  border-color: #2a4254;
  color: #8ccce7;
}
.badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 9px;
  border-radius: 4px;
  padding: 5px 7px;
  background: #202a1e;
  color: var(--lime);
}
.badge.waiting {
  background: #30281d;
  color: var(--orange);
}
.badge.paused {
  background: #262736;
  color: #b6afda;
}
.badge.done {
  background: #1b2b33;
  color: #89c7dc;
}
.badge.error {
  background: #352022;
  color: #ee9393;
}
.card h3 {
  font:
    500 16px "Space Grotesk",
    sans-serif;
  letter-spacing: -0.3px;
  margin: 0 0 8px;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  font-size: 10px;
  color: #b9c2d0;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}
.card-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #8590a0;
  font-size: 10px;
  margin: 14px 0 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6f7c8f;
  font: 9px monospace;
}
.open-detail {
  background: transparent;
  color: #bec9d7;
  font:
    10px "DM Sans",
    sans-serif;
  padding: 6px;
}
.open-detail:hover {
  color: var(--lime);
}
footer {
  display: flex;
  gap: 15px;
  justify-content: space-between;
  color: #4f5b6d;
  font-size: 9px;
  margin-top: 33px;
  padding-top: 20px;
  border-top: 1px solid #1d232d;
}
footer > span:first-child {
  letter-spacing: 1.6px;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 70px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
}
dialog {
  background: #11161e;
  color: var(--text);
  border: 1px solid #35404f;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 30px 100px #0009;
}
dialog::backdrop {
  background: #05070bd4;
  backdrop-filter: blur(5px);
}
.details {
  width: 850px;
  max-width: calc(100vw - 30px);
  max-height: 90vh;
  overflow: hidden;
}
#detail-content {
  height: calc(90vh - 2px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#detail-content > .dialog-heading,
#detail-content > .detail-actions {
  flex-shrink: 0;
}
.dialog-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #11161e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px;
  border-bottom: 1px solid var(--line);
}
.dialog-heading h2 {
  margin-top: 8px;
  font-size: 23px;
}
.icon-button {
  background: #232b37;
  color: #aeb9c9;
  font-size: 22px;
  border-radius: 6px;
  width: 30px;
  height: 30px;
}
.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.detail-body > .conversation,
.detail-body > .detail-side {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.conversation {
  padding: 25px;
  min-width: 0;
}
.detail-side {
  display: block;
  background: #0e131a;
  border-left: 1px solid var(--line);
  padding: 25px 20px;
}
.detail-side dt {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 8px;
}
.detail-side dd {
  font-size: 12px;
  margin: 0 0 24px;
  overflow-wrap: anywhere;
}
.message {
  background: #1b222d;
  border: 1px solid #2a3442;
  padding: 14px;
  border-radius: 8px;
  margin: 14px 0;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.message.agent {
  background: #18221c;
  border-color: #2c3b2d;
}
.message strong {
  display: block;
  font-size: 10px;
  color: var(--lime);
  margin-bottom: 5px;
}
.message.user strong {
  color: #aebed8;
}
.timeline {
  padding: 12px 0;
  color: #8c9aab;
  font: 10px monospace;
  line-height: 1.8;
}
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 15px 25px;
  border-top: 1px solid var(--line);
}
.detail-actions button {
  font-size: 11px;
}
.form-note {
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
}
@media (min-width: 1600px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1150px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .content {
    padding: 30px 25px;
  }
  .stat {
    padding: 16px;
  }
  .stat-value small {
    display: block;
    margin: 5px 0 0;
  }
  .sidebar {
    width: 215px;
    padding: 25px 16px;
  }
  .brand {
    font-size: 18px;
    gap: 6px;
  }
  main {
    margin-left: 215px;
  }
}
@media (max-width: 760px) {
  .sidebar {
    position: relative;
    width: auto;
    padding: 15px;
    gap: 15px;
  }
  .brand {
    font-size: 22px;
  }
  .nav-label {
    display: none;
  }
  nav {
    display: flex;
  }
  nav button {
    flex: 1;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  main {
    margin-left: 0;
  }
  header {
    height: 50px;
    padding: 0 20px;
  }
  .content {
    padding: 25px 18px;
  }
  .heading {
    align-items: flex-start;
    gap: 15px;
  }
  h1 {
    font-size: 29px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 25px;
  }
  .stat:nth-child(2) {
    border: 0;
  }
  .stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .search {
    flex-basis: 100%;
  }
  .toolbar select {
    flex: 1;
    min-width: 0;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .detail-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 2fr) minmax(0, 1fr);
  }
  .detail-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .dialog-heading {
    padding: 20px;
  }
  .dialog-heading h2 {
    font-size: 20px;
  }
  .conversation {
    padding: 20px;
  }
  footer {
    flex-wrap: wrap;
  }
  .live-label {
    font-size: 9px;
  }
  .stats .stat-value {
    font-size: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

[hidden] { display: none !important; }
.message-text { white-space: pre-wrap; }
#connection-error, #event-error { color: var(--orange); line-height: 1.6; }
#load-more { margin-top: 20px; }
button:disabled, button[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.badge.unknown, .badge.idle, .badge.deleting { color: #b1bac9; background: #252b36; }

.server > .dot { flex-shrink: 0; align-self: flex-start; margin-top: 5px; }
.server .diagnostic-error { color: var(--orange); }
