:root {
  color-scheme: light;
  --base: #f4f7fd;
  --panel: rgba(255, 255, 255, .73);
  --raised: #f0f3fa;
  --line: #cfd8eb;
  --line-subtle: #dce3ef;
  --ink: #17233e;
  --muted: #4b5875;
  --subtle: #5c6a87;
  --accent: #4c60b6;
  --accent-strong: #35499e;
  --accent-wash: #e8edfc;
  --teal: #187567;
  --danger: #a63752;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "DM Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --panel-shadow: 0 24px 65px -48px #3545728c, inset 0 1px 0 #fff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  background:
    radial-gradient(ellipse 58% 610px at 4% 110px, #dce4ffb8, transparent 88%),
    radial-gradient(ellipse 43% 570px at 91% 145px, #ede5fba8, transparent 89%),
    radial-gradient(ellipse 30% 460px at 61% 480px, #fae8e982, transparent 92%),
    var(--base);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 30; background: var(--ink); color: white; padding: 8px 12px; border-radius: 8px; }

.topbar { border-bottom: 1px solid #cfd8eb9c; background: #f8faff70; backdrop-filter: blur(18px); }
.topbar-inner {
  max-width: 1440px; min-height: 68px; padding: 0 clamp(20px, 4vw, 58px); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 20px;
}
.brand { justify-self: start; display: inline-flex; gap: 10px; align-items: center; font-size: 17px; font-weight: 750; letter-spacing: -.045em; white-space: nowrap; }
.brand-mark {
  display: flex; align-items: end; justify-content: center; gap: 3px;
  width: 33px; height: 33px; padding-bottom: 8px; border-radius: 11px;
  color: #35499e; background: linear-gradient(140deg, #edf1ff, #d8d7f8); box-shadow: inset 0 0 0 1px #fff9;
}
.brand-mark i { width: 4px; height: 7px; background: currentColor; border-radius: 2px; }
.brand-mark i:nth-child(2) { height: 16px; }
.brand-mark i:nth-child(3) { height: 12px; }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a { padding: 8px 13px; border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 590; white-space: nowrap; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--accent-strong); background: #fff9; }
.topbar nav a[aria-current] { box-shadow: 0 0 0 1px #d5dff2; }
.connection {
  min-width: 0; justify-self: end; display: flex; align-items: center; gap: 7px;
  color: var(--muted); font: 11px/1.3 var(--mono); white-space: nowrap;
}
.connection i, .state::before, .graph-footer i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #8795b0; flex: none; }
.connection i[data-state=live] { background: var(--accent); box-shadow: 0 0 0 3px #8c9def41; }
.connection i[data-state=retrying] { background: var(--danger); }
.connection i[data-state=recorded] { background: var(--teal); }

.studio { max-width: 1440px; padding: clamp(31px, 3.25vw, 47px) clamp(20px, 4vw, 58px) 27px; margin: auto; }
.intro {
  display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1fr);
  align-items: center; gap: clamp(26px, 5.6vw, 90px); margin-bottom: clamp(26px, 2.65vw, 39px);
}
.intro-copy { min-width: 0; padding: 0 0 4px; }
.intro h1 { margin: 0 0 15px; font-size: clamp(51px, 7vw, 99px); line-height: .89; letter-spacing: -.079em; font-weight: 710; }
.intro-copy p { margin: 0; max-width: 29ch; color: var(--muted); font-size: clamp(16px, 1.7vw, 22px); letter-spacing: -.021em; line-height: 1.43; }

.composer {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px 10px;
  min-width: 0; padding: clamp(12px, 1.5vw, 19px); border: 1px solid #fff;
  border-radius: clamp(20px, 2.8vw, 34px);
  background: linear-gradient(145deg, #ffffffc4, #faffffc2 54%, #edf0fdc9);
  box-shadow: 0 26px 48px -37px #344885a6, 0 0 0 1px #cad6ed85;
  backdrop-filter: blur(20px);
}
.composer-draft, .composer-feedback { grid-column: 1 / -1; }
.composer-draft label, .composer-access label { display: block; font-size: 13px; font-weight: 650; letter-spacing: -.012em; }
.composer-draft label { margin: 0 5px 8px; }
.composer textarea, .composer-access input {
  display: block; width: 100%; border: 1px solid #cbd5eb; border-radius: 15px;
  color: var(--ink); background: #fffdfdba;
}
.composer textarea {
  min-height: 73px; max-height: 300px; resize: vertical; padding: 11px 13px;
  font-size: 15px; line-height: 1.5;
}
.composer textarea::placeholder { color: var(--subtle); }
.composer textarea:focus-visible, .composer-access input:focus-visible { outline-offset: 1px; }
.composer-examples { display: flex; flex-wrap: wrap; align-self: center; gap: 6px; }
.composer-examples button {
  min-height: 32px; padding: 4px 10px; border: 1px solid #cbd7ee;
  border-radius: 999px; color: var(--accent-strong); background: #f8faffb8; font-size: 12px;
}
.composer-examples button:hover { border-color: #a5b1db; background: var(--accent-wash); }
.composer-actions { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 10px; }
.composer:has(.composer-access:not([hidden])) :is(.composer-examples, .composer-actions) { grid-column: 1 / -1; }
.composer-access { flex: 1 1 145px; }
.composer-access label { margin: 0 0 3px 4px; font-size: 11px; }
.composer-access input { min-height: 39px; padding: 5px 11px; border-radius: 12px; }
.composer-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 41px; padding: 0 15px; border: 1px solid #25345e;
  border-radius: 999px; color: #fff; background: #23335e; font-size: 13px; font-weight: 630; white-space: nowrap;
}
.composer-submit:not(:disabled):hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.composer-submit span { color: #e4ebff; font-size: 16px; }
.composer-feedback { display: none; }
.composer-feedback:has(:not([hidden])) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 11px; margin: 0 4px; }
.composer-feedback p { margin: 0; color: var(--muted); font-size: 12px; }
.composer-feedback p[data-tone=error] { color: var(--danger); }
.composer-feedback p[data-tone=success] { color: var(--teal); }
.text-button {
  padding: 0; border: 0; background: transparent; color: var(--accent-strong);
  font-size: 12px; font-weight: 620; text-decoration: underline; text-underline-offset: 3px;
}
.text-button:hover { color: var(--ink); }

.run-overview {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .76fr); gap: 22px;
  align-items: center; padding: 0 2px 17px;
}
.run-description { min-width: 0; }
.run-description h2 { margin: 0 0 2px; font-size: 13px; font-weight: 690; }
.run-description p { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.run-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; margin-top: 8px; }
.state {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #f8faffab;
  font: 11px/1.2 var(--mono); white-space: nowrap; text-transform: capitalize;
}
.state::before { content: ""; width: 5px; height: 5px; }
.state[data-tone=running] { color: var(--accent-strong); border-color: #bbc9f1; background: #e9efff; }
.state[data-tone=running]::before { background: var(--accent); }
.state[data-tone=success] { color: var(--teal); border-color: #b9ded5; background: #edf9f5; }
.state[data-tone=success]::before { background: var(--teal); }
.state[data-tone=error] { color: var(--danger); border-color: #e7c4cd; background: #fdf1f3; }
.state[data-tone=error]::before { background: var(--danger); }
.provider { max-width: 100%; overflow: hidden; text-overflow: ellipsis; color: var(--subtle); font: 11px var(--mono); white-space: nowrap; }

.metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden;
  border: 1px solid #fff; border-radius: 19px;
  background: #ffffff9e; box-shadow: 0 0 0 1px #d5def0bf;
}
.metrics div { display: flex; flex-direction: column; align-items: start; gap: 5px; padding: 11px 14px; }
.metrics div + div { border-left: 1px solid var(--line-subtle); }
.metrics span { color: var(--muted); font-size: 11px; font-weight: 580; }
.metrics strong { font: 560 clamp(18px, 2vw, 25px)/1.15 var(--mono); letter-spacing: -.05em; }
#active-count { color: var(--accent-strong); }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(275px, 330px); gap: 15px; align-items: start; }
.panel { min-width: 0; border: 1px solid #fff; background: var(--panel); border-radius: 26px; overflow: hidden; box-shadow: 0 0 0 1px #cdd8edbf, var(--panel-shadow); }
.panel-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 55px; padding: 8px 15px 8px 18px; border-bottom: 1px solid var(--line-subtle);
}
.panel-heading > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.panel h2 { margin: 0; font-weight: 680; font-size: 16px; letter-spacing: -.028em; white-space: nowrap; }
.panel-context { color: var(--subtle); font: 10px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-heading .graph-controls, .panel-heading .play-controls { gap: 5px; flex: 0 0 auto; }
.icon-button, .live-button {
  align-items: center; justify-content: center; min-width: 32px; height: 32px; display: inline-flex; padding: 0 7px;
  color: var(--muted); background: #fcfdffb9; border: 1px solid var(--line);
  border-radius: 10px; font: 12px/1 var(--mono);
}
.icon-button:not(:disabled):hover, .live-button:not(:disabled):hover { border-color: #a6b4da; color: var(--ink); background: #fff; }
.play-button { color: var(--accent-strong); }
.live-button[aria-pressed=true] { color: var(--accent-strong); border-color: #bdc9ee; background: var(--accent-wash); }
.latest-activity {
  width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  color: var(--ink); background: #f1f5fcd9; padding: 7px 17px; border: 0; border-bottom: 1px solid var(--line-subtle);
  text-align: left; font-size: 12px;
}
.latest-activity:disabled { opacity: .7; }
.latest-activity:not(:disabled):hover { background: var(--accent-wash); }
.latest-activity:focus-visible { outline-offset: -2px; }
#latest-action { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#latest-time { color: var(--muted); font: 10px var(--mono); }

.graph-viewport {
  height: clamp(330px, 42vw, 470px); position: relative; overflow: auto;
  background:
    radial-gradient(circle, #657fb12e .8px, transparent 1px) 0 0 / 17px 17px,
    radial-gradient(ellipse at 53% 10%, #e5eaff 5%, transparent 63%),
    radial-gradient(ellipse at 92% 83%, #ece5fa 0%, transparent 66%),
    radial-gradient(ellipse at 8% 91%, #e0edf9, transparent 60%),
    #f7f9fe;
  scrollbar-color: #b7c4df transparent; overscroll-behavior: contain;
}
#graph-spacer { position: relative; margin-inline: auto; min-height: 100%; }
#graph-stage { position: absolute; left: 0; transform-origin: top left; }
#graph-edges, #graph-nodes { position: absolute; inset: 0; overflow: visible; }
#graph-nodes { pointer-events: none; }
.branch-card {
  --signal: var(--accent-strong); position: absolute; display: grid; grid-template-columns: 29px minmax(0, 1fr);
  align-items: start; gap: 9px; width: 190px; min-height: 66px; padding: 9px;
  text-align: left; color: var(--ink); background: #fffdeff5; border: 1px solid #cbd6ef;
  border-radius: 17px; pointer-events: auto; transition: border-color .16s, background-color .16s;
}
.branch-card:hover, .branch-card[aria-pressed=true] { border-color: var(--accent); background: #eef2ff; }
.branch-card[data-tone=success] { --signal: var(--teal); }
.branch-card[data-tone=error] { --signal: var(--danger); }
.branch-card[data-tone=waiting] { --signal: var(--subtle); }
.agent-mark {
  margin-top: 2px; display: grid; place-items: center; width: 27px; height: 27px;
  border: 1px solid #ccd7ef; border-radius: 9px; color: var(--signal); font: 700 13px var(--mono); background: #eef2ff;
}
.agent-copy { min-width: 0; display: grid; }
.agent-name { font-size: 12px; font-weight: 650; line-height: 1.2; min-height: 15px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.agent-status { color: var(--signal); font: 10px/1.2 var(--mono); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-status::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; margin: 0 6px 2px 0; }
.edge-base { fill: none; stroke: #93a4ca; stroke-width: 1.5; }
.edge-signal { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; opacity: 0; }
.graph-footer { display: flex; gap: 14px; padding: 10px 16px 11px 18px; border-top: 1px solid var(--line-subtle); color: var(--muted); font: 10px var(--mono); }
.graph-footer span { white-space: nowrap; }
.graph-footer i { width: 6px; height: 6px; margin: 0 5px 1px 0; }
.graph-footer i[data-tone=running] { background-color: var(--accent); }
.graph-footer i[data-tone=success] { background-color: var(--teal); }
.zoom-percent { margin-left: auto; color: var(--subtle); }
.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 24px; text-align: center; }
.empty h3 { margin: 14px 0 4px; font-size: 16px; }
.empty p, .empty-text { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }
.empty-symbol { display: grid; grid-template-columns: repeat(2, 7px); gap: 5px; padding: 12px; background: #f9fbffbd; border: 1px solid #cdd9f1; border-radius: 13px; }
.empty-symbol i { width: 7px; height: 7px; background: #a4b0ce; border-radius: 2px; }
.empty-symbol i:first-child { background: var(--accent); }
.empty-symbol i:last-child { background: var(--teal); }

.inspector { grid-column: 2; grid-row: 1 / span 2; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 5px; gap: 3px; border-bottom: 1px solid var(--line-subtle); }
.tabs button {
  padding: 6px 3px; border: 1px solid transparent; border-radius: 999px; background: transparent;
  color: var(--muted); font-size: 12px; min-height: 35px;
}
.tabs button:hover { color: var(--ink); background: #fff9; }
.tabs button[aria-selected=true] { color: var(--accent-strong); border-color: #c7d3ef; background: var(--accent-wash); font-weight: 630; }
.tabs button:focus-visible { outline-offset: -2px; }
.inspector-content { min-height: 352px; max-height: 670px; overflow: auto; padding: 16px 17px; scrollbar-color: #b7c4df transparent; overflow-wrap: anywhere; }
.inspector-content h3 { margin: 0 0 8px; letter-spacing: -.035em; font-size: 20px; line-height: 1.2; }
.inspector-content h4 { font-size: 11px; color: var(--muted); font-weight: 640; margin: 17px 0 5px; }
.inspector-content p { margin: 0 0 8px; font-size: 13px; }
.inspector-content .state { margin-bottom: 6px; }
.inspector-content pre {
  max-height: 335px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  margin: 0; padding: 11px; color: var(--ink); border: 1px solid var(--line-subtle); border-radius: 12px;
  background: #f4f7fd; font: 11px/1.55 var(--mono);
}
.inspector-content details { border-bottom: 1px solid var(--line-subtle); padding: 9px 0; }
.inspector-content details summary { cursor: pointer; color: var(--accent-strong); font: 11px/1.4 var(--mono); }
.inspector-content details[open] summary { margin-bottom: 8px; }
.source-link { display: block; color: var(--accent-strong); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.source-item + .source-item { padding-top: 12px; margin-top: 11px; border-top: 1px solid var(--line-subtle); }
.source-item p, .detail-time { color: var(--muted); font: 10px/1.5 var(--mono); }
.inspector-link {
  display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 5px; padding: 7px 0;
  color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line-subtle);
  text-align: left; font-size: 12px;
}
.inspector-link:hover { color: var(--accent-strong); }
.inspector-link .detail-time { white-space: nowrap; }

.activity { grid-column: 1; }
.timeline { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line-subtle); }
.timeline input { flex: 1; min-width: 60px; accent-color: var(--accent-strong); cursor: pointer; }
.timeline input:disabled { cursor: default; opacity: .5; }
.timeline output { min-width: 70px; text-align: right; font: 11px var(--mono); color: var(--muted); }
.activity-feed { max-height: 252px; min-height: 89px; overflow: auto; scrollbar-color: #b7c4df transparent; overscroll-behavior: contain; }
.activity-feed .empty-text { padding: 15px; }
.activity-feed ol { list-style: none; margin: 0; padding: 0; }
.activity-feed li + li { border-top: 1px solid var(--line-subtle); }
.event-button {
  display: grid; grid-template-columns: 20px 54px minmax(80px, 1fr) minmax(65px, .62fr);
  gap: 8px; align-items: center; width: 100%; text-align: left; color: var(--ink);
  padding: 7px 15px 7px 17px; background: transparent; border: 0; font-size: 12px; min-height: 39px;
}
.event-button:hover, .event-button[aria-pressed=true] { background-color: #e9efff; }
.event-button:focus-visible { outline-offset: -2px; }
.event-icon {
  display: grid; place-items: center; width: 19px; height: 19px; color: var(--accent-strong);
  background: #edf1ff; border: 1px solid #cbd5f3; border-radius: 6px; font: 11px var(--mono);
}
[data-kind=tool] .event-icon, [data-kind=verification] .event-icon { color: var(--teal); background: #eff9f6; border-color: #badfd7; }
[data-kind=error] .event-icon { color: var(--danger); background: #fdf1f3; border-color: #e7c4cd; }
.event-time { color: var(--muted); font: 10px var(--mono); }
.event-label, .event-agent { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.event-agent { text-align: right; color: var(--subtle); font: 10px var(--mono); }
.studio-footer { display: flex; justify-content: space-between; gap: 10px; margin: 16px 2px 0; color: var(--subtle); font: 10px/1.5 var(--mono); overflow-wrap: anywhere; }
.studio-footer a { flex: 0 0 auto; color: var(--accent-strong); }
.studio-footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1000px) {
  .workbench { grid-template-columns: minmax(0, 1fr) minmax(250px, 285px); }
  .metrics div { padding-inline: 10px; }
}
@media (max-width: 760px) {
  .topbar-inner { min-height: 59px; gap: 10px; }
  .intro { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .intro h1 { margin-bottom: 12px; }
  .intro-copy p { max-width: 31ch; }
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .graph, .inspector, .activity { grid-column: 1; grid-row: auto; }
  .inspector { order: 3; }
  .inspector-content { min-height: 155px; max-height: 485px; }
  .graph-viewport { height: clamp(360px, 81vw, 445px); }
  .run-overview { grid-template-columns: minmax(0, 1fr); gap: 15px; padding-inline: 0; }
}
@media (max-width: 480px) {
  .topbar-inner { padding-inline: 14px; grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand { gap: 6px; font-size: 15px; }
  .brand-mark { width: 27px; height: 27px; padding-bottom: 6px; border-radius: 8px; }
  .brand-mark i { width: 3px; }
  .brand-mark i:nth-child(2) { height: 13px; }
  .brand-mark i:nth-child(3) { height: 10px; }
  .topbar nav { justify-self: end; }
  .topbar nav a { font-size: 11px; padding: 6px 7px; }
  .topbar nav a:first-child { display: none; }
  .connection span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .connection i { width: 6px; height: 6px; }
  .studio { padding: 30px 14px 18px; }
  .composer textarea { font-size: 16px; }
  .composer-access input { font-size: 16px; }
  .composer :is(.composer-examples, .composer-actions) { grid-column: 1 / -1; }
  .panel { border-radius: 20px; }
  .panel-heading { padding-inline: 12px; }
  .latest-activity, .graph-footer { padding-inline: 12px; }
  .timeline { padding-inline: 12px; }
  .event-button { grid-template-columns: 18px 44px minmax(0, 1fr) minmax(55px, .64fr); gap: 5px; padding-inline: 9px; }
  #timeline-context { display: none; }
  .studio-footer { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
