/* Agent Playground : the framed-sheet style. A tinted frame holds the lab tabs and the tuning form ;
   the run happens on a white sheet. Colour goes on the actors and on what they send, not on chrome. */

@font-face { font-family: "Plex"; src: url("fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --frame: #edf1f3;          /* the frame, a blue-grey step from the scanner rooms of the made-up worlds */
  --surface: #ffffff;
  --raised: #f4f6f8;         /* the stage well, bubbles */
  --active: #e3e7ea;
  --border: #e3e6e9;
  --rule: #eef0f2;
  --control: #c9ccd0;
  --text: #131416;
  --muted: #55585b;
  --faint: #66696c;
  --primary: #17191b;

  --agent: #1b6c80;   --agent-bg: #e1eff2;
  --human: #a3365a;   --human-bg: #f7e6ec;
  --system: #95620a;  --system-bg: #f6ecd8;
  --code: #56606a;    --code-bg: #e8ebee;

  --positive: #1e7b4f; --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --negative: #c4242a; --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #7c3a0b; --warning-edge: #f1d27a;
  --pill-neutral-bg: #e9ecee; --pill-neutral-ink: #353736;

  --font: "Plex", "Segoe UI", system-ui, sans-serif;
  --mono: "Plex Mono", Consolas, "Cascadia Mono", monospace;
  --radius-sheet: 16px; --radius-card: 8px; --radius-control: 6px;
  --gap: 24px; --pad: 24px; --inset: 8px;
  --bar: 52px;
  --tune: clamp(272px, 19vw, 340px);
  --side: clamp(330px, 26vw, 480px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--frame); color: var(--text); font: 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--agent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the frame : top bar and tuning column on one tint, the sheet inset 8px ---------- */
.app { height: 100vh; display: grid; grid-template-columns: var(--tune) minmax(0, 1fr); grid-template-rows: var(--bar) minmax(0, 1fr); }
.bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 28px; padding: 0 calc(var(--inset) + 16px) 0 20px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand b { font-weight: 600; font-size: 15px; }
.brand span { color: var(--muted); font-size: 13px; }
.labs { display: flex; gap: 4px; align-self: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.labs button { border: 0; background: none; padding: 0 12px; color: var(--muted); position: relative; white-space: nowrap;
  transition: color .15s; }
.labs button:hover { color: var(--text); }
.labs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.labs button[aria-selected="true"]::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 0; height: 2px; background: var(--text); border-radius: 2px; }
.labs button:disabled { cursor: not-allowed; opacity: .55; }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 20px; flex: none; }
.budget { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.budget .track { width: 64px; height: 4px; border-radius: 4px; background: var(--active); overflow: hidden; }
.budget .track i { display: block; height: 100%; background: var(--code); border-radius: 4px; }
.bar-end a { color: var(--muted); text-decoration: none; font-size: 13px; }
.bar-end a:hover { color: var(--text); }

/* ---------- tuning column ---------- */
.tune { display: flex; flex-direction: column; min-height: 0; }
.tune-scroll { flex: 1; overflow-y: auto; padding: 8px 16px 16px 20px; scrollbar-width: thin; }
.tune h2 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 8px 0 4px; }
.tune .lead { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--control); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px;
  line-height: 20px; transition: background .15s, border-color .15s, transform .12s; text-align: left; }
.chip:hover { border-color: var(--text); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--text); color: #fff; border-color: var(--text); }
.preset-note { color: var(--muted); font-size: 12px; line-height: 18px; margin: 0 0 14px; min-height: 18px; }

.group { border-top: 1px solid var(--control); border-top-color: #dde2e5; }
.group:last-child { border-bottom: 1px solid #dde2e5; }
.group > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 11px 0; cursor: pointer; font-weight: 600; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg); transition: transform .2s var(--ease); margin: 0 3px 0 1px; }
.group[open] > summary::before { transform: rotate(45deg); }
.group > summary .changed { margin-left: auto; color: var(--agent); font-weight: 400; font-size: 12px; }
.group-body { padding: 0 0 14px; display: grid; gap: 16px; }

.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.field.edited > label::after, .field.edited > .label::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--agent); }
.field .help { color: var(--muted); font-size: 12px; line-height: 17px; margin: 0; }
.input, .field select, .field textarea, .field input[type=text], .field input[type=number] {
  width: 100%; background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius-control);
  padding: 7px 10px; min-height: 36px; transition: border-color .15s; }
.field textarea { resize: vertical; line-height: 19px; font-size: 13px; }
.field select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2355585b' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.input:hover, .field select:hover, .field textarea:hover, .field input:hover { border-color: #9da2a7; }
.count { color: var(--faint); font-size: 12px; text-align: right; margin-top: -2px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { appearance: none; width: 32px; height: 18px; border-radius: 9px; background: #b8bdc2; position: relative; margin: 0;
  flex: none; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: transform .2s var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(14px); }

/* the agents editor */
.agents { display: grid; gap: 10px; }
.agent-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px; display: grid; gap: 8px;
  animation: arrive .25s var(--ease); }
.agent-head { display: flex; gap: 6px; align-items: center; }
.agent-head .disc { flex: none; }
.agent-head input { flex: 1; min-width: 0; font-weight: 600; }
.icon-btn { width: 30px; height: 30px; border: 0; background: none; border-radius: var(--radius-control); display: grid; place-items: center;
  color: var(--muted); flex: none; transition: background .15s, color .15s; }
.icon-btn:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn svg { width: 14px; height: 14px; }
.tool-picks { display: flex; flex-wrap: wrap; gap: 5px; }
.tool-picks label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--control); border-radius: 999px; padding: 2px 10px 2px 8px;
  font-size: 12px; cursor: pointer; background: var(--surface); transition: background .15s, border-color .15s; }
.tool-picks input { margin: 0; accent-color: var(--agent); }
.tool-picks label:has(input:checked) { background: var(--agent-bg); border-color: #a9cdd6; }
.add-agent { justify-self: start; border: 1px dashed var(--control); background: none; border-radius: var(--radius-control); padding: 6px 12px; font-size: 13px; }
.add-agent:hover:not(:disabled) { border-color: var(--text); }
.add-agent:disabled { color: var(--faint); cursor: default; }

/* the action dock at the foot of the tuning column */
.dock { padding: 14px 16px 16px 20px; display: grid; gap: 8px; border-top: 1px solid #dde2e5; }
.dock-row { display: flex; gap: 8px; }
.btn { height: 36px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .12s, opacity .15s; }
.btn:hover:not(:disabled) { border-color: var(--text); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); height: 42px; font-weight: 600; font-size: 15px; }
.btn.primary:hover:not(:disabled) { background: #000; }
.btn.primary .live-dot { width: 8px; height: 8px; border-radius: 50%; background: #5fd0a0; }
.btn.text { border-color: transparent; background: none; color: var(--muted); padding: 0 10px; }
.btn.text:hover:not(:disabled) { color: var(--text); border-color: transparent; background: rgba(0,0,0,.04); }
.btn.grow { flex: 1; }
.btn svg { width: 14px; height: 14px; flex: none; }

.menu { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px;
  box-shadow: 0 10px 30px rgba(20, 30, 40, .14); width: 320px; max-height: 60vh; overflow-y: auto; animation: arrive .16s var(--ease); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.menu button:hover, .menu button:focus-visible { background: var(--raised); }
.menu b { display: block; font-weight: 600; }
.menu span { display: block; color: var(--muted); font-size: 12px; line-height: 17px; }
.menu .empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ---------- the sheet ---------- */
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); margin: 0 var(--inset) var(--inset) 0;
  min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 20px var(--pad) var(--pad); }
.title-row { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 18px; }
.title-row h1 { font-size: 22px; line-height: 28px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.title-row .summary { color: var(--muted); margin: 3px 0 0; max-width: 80ch; }
.about { margin-left: auto; flex: none; }
.work { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--side); gap: var(--gap); }

/* the stage card */
.stage-card { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stage-head { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px; height: 48px; border-bottom: 1px solid var(--border); flex: none; }
.status { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.status .text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status .text b { font-weight: 600; }
.signal { width: 8px; height: 8px; border-radius: 50%; background: #b8bdc2; flex: none; }
.signal.live { background: var(--positive); animation: beat 1.4s ease-in-out infinite; }
.signal.wait { background: #d79b16; animation: beat 1.4s ease-in-out infinite; }
.signal.replay { background: var(--agent); }
.signal.bad { background: var(--negative); }
@keyframes beat { 50% { transform: scale(1.5); opacity: .55; } }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; flex: none; }
.pill.ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.no { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.open { background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.wait { background: var(--pill-warning-bg); color: var(--pill-warning-ink); box-shadow: inset 0 0 0 1px var(--warning-edge); }
.transport { display: flex; align-items: center; gap: 4px; flex: none; }
.transport .btn { height: 30px; padding: 0 10px; font-size: 13px; }
.seg { display: inline-flex; background: var(--raised); border-radius: var(--radius-control); padding: 2px; }
.seg button { border: 0; background: none; height: 26px; padding: 0 9px; border-radius: 5px; font-size: 12px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }

.stage { position: relative; flex: 1; min-height: 300px; background: var(--raised); overflow: hidden; }
.stage svg.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wire { fill: none; stroke: #c3c8cd; stroke-width: 1.5; transition: stroke .4s, stroke-width .4s; }
.wire.hot { stroke-width: 2.5; stroke-dasharray: 6 6; animation: flow .6s linear infinite; }
.wire.hot.agent { stroke: var(--agent); } .wire.hot.human { stroke: var(--human); }
.wire.hot.system { stroke: var(--system); } .wire.hot.code { stroke: var(--code); }
.wire.handover { stroke-width: 3; }
@keyframes flow { to { stroke-dashoffset: -12; } }
.traffic { position: absolute; transform: translate(-50%, -50%); z-index: 1; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--surface); box-shadow: inset 0 0 0 1px #c3c8cd; color: var(--muted); font-size: 11px; line-height: 18px; text-align: center; pointer-events: none; }
.col-label { position: absolute; top: 14px; transform: translateX(-50%); color: var(--faint); font-size: 12px; white-space: nowrap; }

.actor { position: absolute; transform: translate(-50%, -50%); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px 9px 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 9px; align-items: start;
  transition: transform .3s var(--ease), border-color .3s, opacity .4s, left .5s var(--ease), top .5s var(--ease); }
.actor.enter { animation: enter .5s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translate(-50%, -38%) scale(.94); } }
.actor .who { min-width: 0; }
.actor .name { font-weight: 600; font-size: 14px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actor .note { color: var(--muted); font-size: 12px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actor .stats { color: var(--faint); font-size: 12px; line-height: 16px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actor .stats:empty { display: none; }
.actor .timer { position: absolute; top: -9px; right: 8px; background: var(--agent); color: #fff; font-size: 11px; line-height: 18px; height: 18px;
  padding: 0 7px; border-radius: 9px; font-variant-numeric: tabular-nums; opacity: 0; transform: translateY(3px); transition: opacity .2s, transform .2s; }
.actor .sweep { position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; overflow: hidden; border-radius: 2px; opacity: 0; }
.actor .sweep::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--agent); animation: sweep 1.1s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.actor.thinking { border-color: var(--agent); box-shadow: 0 0 0 1px var(--agent); }
.actor.thinking .timer, .actor.thinking .sweep { opacity: 1; transform: none; }
.actor.thinking::before { content: ""; position: absolute; inset: -1px; border-radius: 10px; border: 2px solid var(--agent); animation: ring 1.6s ease-out infinite; pointer-events: none; }
@keyframes ring { from { opacity: .5; transform: scale(1); } to { opacity: 0; transform: scale(1.09, 1.22); } }
.actor.bump { animation: bump .45s var(--ease); }
@keyframes bump { 40% { transform: translate(-50%, -50%) scale(1.045); } }
.actor.speaking { border-color: #9da2a7; }
.actor.waiting { border-color: #d79b16; box-shadow: 0 0 0 1px #d79b16; }
.actor.waiting::before { content: ""; position: absolute; inset: -1px; border-radius: 10px; border: 2px solid #d79b16; animation: ring 1.6s ease-out infinite; }
.actor.holder .name::after { content: " · has the conversation"; font-weight: 400; color: var(--agent); font-size: 12px; }
.actor.dim { opacity: .55; }
.actor.compact { padding: 6px 9px 6px 8px; }
/* narrow cards, on a small laptop : the kind moves to a left edge, the name may wrap */
.actor.narrow { grid-template-columns: minmax(0, 1fr); padding: 8px 9px 8px 11px; }
.actor.narrow > .disc { display: none; }
.actor.narrow::after { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; }
.actor.narrow.agent::after { background: var(--agent); } .actor.narrow.human::after { background: var(--human); }
.actor.narrow.system::after { background: var(--system); } .actor.narrow.code::after { background: var(--code); }
.actor.narrow .name { white-space: normal; font-size: 13px; line-height: 17px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.actor.compact .note { display: none; }

.disc { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.disc.agent { background: var(--agent-bg); color: var(--agent); }
.disc.human { background: var(--human-bg); color: var(--human); }
.disc.system { background: var(--system-bg); color: var(--system); border-radius: 6px; }
.disc.code { background: var(--code-bg); color: var(--code); border-radius: 6px; }
.disc.sm { width: 22px; height: 22px; font-size: 11px; }

.token { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; background: var(--text); color: #fff; font-size: 12px; line-height: 22px;
  height: 22px; padding: 0 10px 0 8px; border-radius: 11px; white-space: nowrap; display: flex; align-items: center; gap: 6px; max-width: 230px;
  box-shadow: 0 4px 14px rgba(15, 25, 35, .22); offset-rotate: 0deg; offset-anchor: 50% 50%; }
.token i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.token span { overflow: hidden; text-overflow: ellipsis; }
.token i.agent { background: #7cc4d4; } .token i.human { background: #f09ab5; } .token i.system { background: #f0bf63; } .token i.code { background: #c6ccd2; }

.legend { position: absolute; left: 14px; bottom: 10px; display: flex; gap: 14px; color: var(--faint); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .disc { width: 10px; height: 10px; }
.legend .disc.system, .legend .disc.code { border-radius: 2px; }
.legend .disc.agent { background: var(--agent); } .legend .disc.human { background: var(--human); }
.legend .disc.system { background: var(--system); } .legend .disc.code { background: var(--code); }

/* the stage before any run : the lab's intro, set where the team will appear */
.stage-empty { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start;
  padding: 40px 40px 32px; overflow-y: auto; }
.stage-empty .copy p { font-size: 16px; line-height: 25px; margin: 0 0 14px; max-width: 46ch; }
.stage-empty .copy p:first-child { font-size: 18px; line-height: 27px; }
.stage-empty .copy .hint { color: var(--muted); font-size: 14px; line-height: 21px; }
.recs { display: grid; gap: 6px; margin-top: 22px; }
.recs-title { font-weight: 600; margin-bottom: 2px; }
.rec { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; text-align: left; border: 1px solid var(--border);
  background: var(--surface); border-radius: 8px; padding: 9px 12px 9px 10px; transition: border-color .15s, transform .12s; }
.rec:hover { border-color: var(--text); }
.rec:active { transform: scale(.99); }
.rec svg { width: 28px; height: 28px; padding: 8px; border-radius: 50%; background: var(--text); color: #fff; }
.rec b { display: block; font-weight: 600; }
.rec span span { display: block; color: var(--muted); font-size: 12.5px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec > span { min-width: 0; }

/* the meters under the stage */
.meters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--border); flex: none; }
.meter { padding: 10px 16px 11px; border-left: 1px solid var(--border); min-width: 0; }
.meter:first-child { border-left: 0; }
.meter .k { color: var(--muted); font-size: 12px; line-height: 16px; }
.meter .v { font-size: 24px; line-height: 30px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter .v small { font-size: 13px; color: var(--muted); margin-left: 2px; }
.meter .v.tick { animation: tick .4s var(--ease); }
@keyframes tick { 30% { color: var(--agent); } }

/* the side column : tabs over the feed and the panels */
.side { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 0 8px; height: 48px; border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 0 9px; color: var(--muted); position: relative; white-space: nowrap; font-size: 14px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 1px; right: 1px; bottom: 0; height: 2px; background: var(--text); border-radius: 2px; }
.tabs button .n { color: var(--faint); font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }
.tabs button.fresh::before { content: ""; position: absolute; top: 12px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--agent); }
.pane { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; position: relative; }
.pane-pad { padding: 16px; }
.pane .empty { color: var(--muted); padding: 24px 20px; line-height: 21px; }
.pane .empty b { color: var(--text); }

/* the feed */
.feed { padding: 8px 0 16px; }
.step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 9px 16px; animation: arrive .35s var(--ease); }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }
.step .disc { margin-top: 1px; }
.step .head { display: flex; gap: 8px; align-items: baseline; }
.step .head .line { flex: 1; min-width: 0; color: var(--muted); }
.step .head .line b { color: var(--text); font-weight: 600; }
.step .head .at { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.step .meta { color: var(--faint); font-size: 12px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.bubble { background: var(--raised); border-radius: 8px; padding: 9px 12px; margin-top: 6px; overflow-x: auto; overflow-wrap: break-word; font-size: 13.5px; line-height: 20px; }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0 0 6px; padding-left: 20px; }
.bubble .h { font-weight: 600; margin: 6px 0 3px; } .bubble .h:first-child { margin-top: 0; }
.bubble code { font-family: var(--mono); font-size: 12px; background: rgba(0,0,0,.05); padding: 0 3px; border-radius: 3px; }
.bubble table { border-collapse: collapse; margin: 4px 0 8px; font-size: 12.5px; line-height: 17px; min-width: 100%; }
.bubble th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 10px 5px 0; border-bottom: 1px solid #dfe3e6; vertical-align: bottom; }
.bubble td { padding: 5px 10px 5px 0; border-bottom: 1px solid #e8ebed; vertical-align: top; }
.bubble tr:last-child td { border-bottom: 0; }
.bubble td:first-child { min-width: 7.5em; }
.bubble td.n, .bubble th.n { text-align: right; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv dd .kv { margin-top: 2px; }
.step.final .bubble { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--text); }
.step.error .bubble { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.args { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 5px; }
.arg { background: var(--raised); border-radius: 5px; padding: 1px 7px; font-size: 12px; line-height: 19px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arg em { font-style: normal; color: var(--muted); }
.decides { color: var(--text); }
details.fold { margin-top: 5px; }
details.fold > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s; }
details.fold[open] > summary::before { transform: rotate(45deg); }
details.fold > summary:hover { color: var(--text); }
.saw { margin-top: 6px; border-left: 2px solid var(--border); padding-left: 10px; display: grid; gap: 8px; }
.saw .role { font-size: 12px; font-weight: 600; color: var(--muted); }
.saw .msg { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; line-height: 18px; max-height: 260px; overflow-y: auto; }
.step.pending .line { color: var(--agent); }
.step.pending .disc { animation: beat 1.4s ease-in-out infinite; }
.answer-line { margin-top: 6px; }
.answer-line .waiting { color: var(--faint); font-size: 12.5px; }

.ask { margin: 8px 16px; border-radius: 10px; background: var(--pill-warning-bg); box-shadow: inset 0 0 0 1px var(--warning-edge); padding: 14px 16px; animation: arrive .35s var(--ease); }
.ask .head { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 8px; }
.ask .kv { font-size: 13.5px; margin-bottom: 12px; }
.ask .choices { display: flex; gap: 8px; flex-wrap: wrap; }
.ask .choices .btn { height: 36px; }
.ask .choices .btn.go { background: var(--primary); color: #fff; border-color: var(--primary); }
.ask .choices .btn.chosen { outline: 2px solid var(--text); outline-offset: 2px; opacity: 1; }
.ask .note { color: var(--pill-warning-ink); font-size: 12.5px; margin-top: 8px; }
.verdict { margin: 10px 16px 4px; border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; animation: arrive .4s var(--ease); }
.verdict.ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.verdict.no { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.verdict.open { background: var(--raised); }
.verdict .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; font-size: 13px; }
.verdict.ok .mark { background: var(--positive); } .verdict.no .mark { background: var(--negative); } .verdict.open .mark { background: var(--code); }
.verdict .sum { font-size: 12px; opacity: .85; margin-top: 2px; font-variant-numeric: tabular-nums; }
.note-line { margin: 6px 16px; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.note-line::before, .note-line::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.fallback { margin: 8px 16px; }
.more-below { position: sticky; bottom: 10px; left: 0; margin: 0 auto; display: flex; width: max-content; z-index: 2; background: var(--text); color: #fff;
  border: 0; border-radius: 999px; height: 30px; padding: 0 14px; font-size: 13px; align-items: center; box-shadow: 0 4px 14px rgba(15, 25, 35, .2); }

/* panels */
.todos { list-style: none; margin: 0; padding: 8px 16px; }
.todos li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); animation: arrive .3s var(--ease); }
.todos li:last-child { border-bottom: 0; }
.todos .box { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #9da2a7; margin-top: 2px; position: relative; }
.todos li.in_progress .box { border-color: var(--agent); }
.todos li.in_progress .box::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--agent); clip-path: inset(0 50% 0 0); }
.todos li.completed .box { background: var(--text); border-color: var(--text); }
.todos li.completed .box::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.todos li.completed .t { color: var(--muted); }
.todos .s { color: var(--faint); font-size: 12px; }
.files { list-style: none; margin: 0; padding: 8px; }
.files button { width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 6px; display: flex; gap: 10px; align-items: center; }
.files button:hover { background: var(--raised); }
.files .path { font-family: var(--mono); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.files .size { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.files .new { color: var(--agent); font-size: 12px; }
.viewer-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface); }
.viewer-head .path { font-family: var(--mono); font-size: 13px; }
.viewer .bubble { background: none; margin: 0; padding: 14px 16px; font-size: 14px; line-height: 21px; }

.cps { list-style: none; margin: 0; padding: 8px; }
.cps button { width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
.cps button:hover { background: var(--raised); }
.cps button[aria-pressed="true"] { background: var(--active); }
.cps .st { font-variant-numeric: tabular-nums; font-weight: 600; }
.cps .nx { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-edit { padding: 4px 16px 16px; display: grid; gap: 14px; border-top: 1px solid var(--rule); }
.cp-edit h3 { font-size: 14px; font-weight: 600; margin: 12px 0 0; }
.cp-edit .help { color: var(--muted); font-size: 12px; margin: 0; }
.cp-edit textarea { font-family: var(--mono); font-size: 12px; line-height: 17px; }

.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
.runs th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 10px 8px 6px; white-space: nowrap; }
.runs td { padding: 9px 8px; border-top: 1px solid var(--rule); vertical-align: top; }
.runs th:first-child, .runs td:first-child { padding-left: 16px; }
.runs th:last-child, .runs td:last-child { padding-right: 16px; }
.runs .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.runs tbody tr { cursor: pointer; transition: background .15s; }
.runs tbody tr:hover { background: var(--raised); }
.runs tbody tr.on { background: var(--active); }
.runs .what b { font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.runs .what .sub { color: var(--muted); font-size: 12px; line-height: 17px; display: block; }
.runs-note { color: var(--muted); font-size: 12px; padding: 10px 16px; margin: 0; }

/* the about dialog */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, 92vw); box-shadow: 0 24px 60px rgba(15, 25, 35, .25); color: var(--text); }
dialog::backdrop { background: rgba(19, 20, 22, .35); }
dialog .in { padding: 24px 28px; }
dialog h2 { margin: 0 0 10px; font-size: 18px; }
dialog p { margin: 0 0 12px; line-height: 22px; }
dialog .end { display: flex; justify-content: flex-end; padding: 0 20px 20px; }

/* ---------- the login page ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
.login .show { padding: 36px 40px; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.login .show .brand b { font-size: 16px; }
.login .show figure { margin: auto 0; }
.login .show figure svg { width: 100%; height: auto; max-height: 62vh; display: block; }
.login .show figcaption { color: var(--muted); max-width: 52ch; margin-top: 14px; }
.login .sheet { margin: var(--inset) var(--inset) var(--inset) 0; justify-content: center; padding: 48px clamp(32px, 6vw, 96px); }
.login form { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.login h1 { font-size: 28px; line-height: 34px; margin: 0; letter-spacing: -0.015em; font-weight: 600; }
.login .sub { color: var(--muted); margin: -8px 0 6px; font-size: 15px; line-height: 22px; }
.login .field input { height: 42px; font-size: 15px; }
.login .btn.primary { width: 100%; }
.login .msg { border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.login .msg.no { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.login .msg.wait { background: var(--pill-warning-bg); color: var(--pill-warning-ink); box-shadow: inset 0 0 0 1px var(--warning-edge); }
.login .small { color: var(--muted); font-size: 12.5px; line-height: 18px; }
.drawn .card { fill: #fff; stroke: var(--border); }
.drawn .wire { stroke: #c3c8cd; }
.drawn text { font-family: var(--font); fill: var(--text); }

/* ---------- smaller screens ---------- */
@media (max-width: 1500px) {
  .stage-empty { gap: 32px; padding: 28px 28px 24px; }
  .stage-empty .copy p { font-size: 15px; line-height: 23px; }
  .stage-empty .copy p:first-child { font-size: 16px; line-height: 25px; }
  .stage-empty .copy .hint { font-size: 13.5px; line-height: 20px; }
  .meter { padding: 9px 12px 10px; }
  .meter .v { font-size: 22px; }
}
@media (max-width: 1100px) {
  :root { --side: 340px; }
  .bar .brand span { display: none; }
  .stage-empty { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { height: auto; min-height: 100vh; display: block; }
  .bar { height: auto; flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px 0; }
  .labs { order: 3; width: 100%; height: 44px; }
  .budget .track { display: none; }
  .tune { padding-bottom: 8px; }
  .tune-scroll { padding: 8px 16px; overflow: visible; }
  .dock { padding: 12px 16px; position: sticky; bottom: 0; background: var(--frame); z-index: 10; }
  .sheet { margin: 0 8px 8px; padding: 16px; }
  .title-row { flex-direction: column; gap: 10px; }
  .about { margin-left: 0; }
  .work { display: flex; flex-direction: column; }
  .stage { min-height: 460px; }
  .side { height: 70vh; }
  .meters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .meter:nth-child(4) { border-left: 0; }
  .meter:nth-child(n+4) { border-top: 1px solid var(--border); }
  .legend { display: none; }
  .login { grid-template-columns: 1fr; }
  .login .show { padding: 20px 16px 0; }
  .login .show figure { display: none; }
  .login .sheet { margin: 16px 8px 8px; padding: 32px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
