/* meta · Agent Studio
 *
 * One small design system, no build step:
 *   - type: 15px text, 13px for what is secondary, never smaller than 12px (labels in capitals)
 *   - space: steps of 4px; one radius for controls (8px), one for surfaces (12px)
 *   - colour says what a thing is, the same everywhere: a state kind, a kind of property,
 *     a family of memory types, a status
 * Every colour has a light and a dark value; which applies is the page's colour scheme — the
 * system's, or the one picked in the header (html[data-theme]), set before the first paint. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f4f5f8, #0d0f13);
  --panel: light-dark(#ffffff, #161921);
  --sunk: light-dark(#f7f8fa, #11141a);
  --raise: light-dark(#ffffff, #1c2029);
  --text: light-dark(#161b22, #e6e9ee);
  --muted: light-dark(#5a6372, #949dac);
  --line: light-dark(#e2e5ea, #272c37);
  --line-strong: light-dark(#c9ced7, #3a4150);
  --accent: light-dark(#4f46e5, #9896fa);
  --accent-ink: light-dark(#ffffff, #0d0f13);
  --accent-soft: light-dark(#eeeefd, #23234a);
  --ok: light-dark(#15803d, #4ade80);
  --ok-soft: light-dark(#e5f5ea, #12301f);
  --bad: light-dark(#b42318, #f87171);
  --bad-soft: light-dark(#fdeceb, #3a1818);
  --warn: light-dark(#b45309, #fbbf24);
  --warn-soft: light-dark(#fff3e0, #36290d);
  --shade: light-dark(rgb(16 24 40 / 0.07), rgb(0 0 0 / 0.45));
  --shade-up: light-dark(rgb(16 24 40 / 0.16), rgb(0 0 0 / 0.6));
  /* one colour per family of state kinds: the diagram, the lists, the picker, the trace */
  --llm: light-dark(#4f46e5, #a5a3fb);
  --tool: light-dark(#b45309, #fbbf24);
  --gate: light-dark(#0f766e, #2dd4bf);
  --mem: light-dark(#7e22ce, #c084fc);
  --team: light-dark(#1d4ed8, #60a5fa);
  --human: light-dark(#be185d, #f472b6);
  --web: light-dark(#4d7c0f, #a3e635);
  /* one per kind of property */
  --invariant: light-dark(#1d4ed8, #60a5fa);
  --safety: light-dark(#b42318, #f87171);
  --liveness: light-dark(#15803d, #4ade80);
  --temporal: light-dark(#7e22ce, #c084fc);
  --fairness: light-dark(#b45309, #fbbf24);
  /* one per family of memory types */
  --f-conversation: light-dark(#1d4ed8, #60a5fa);
  --f-lookup: light-dark(#0f766e, #2dd4bf);
  --f-record: light-dark(#7e22ce, #c084fc);
  --f-shared: light-dark(#b45309, #fbbf24);
  --f-own: light-dark(#5a6372, #949dac);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --top: 56px;
  --r: 8px;
  --R: 12px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 14px; }
p { margin: 0 0 8px; }
pre { margin: 0; font: 13.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
code { font: 0.92em var(--mono); background: var(--sunk); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
pre code, .code code { border: 0; background: none; padding: 0; }
.grow { flex: 1; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.mono { font-family: var(--mono); font-size: 0.93em; }
.pad { padding: 14px 16px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.none { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
/* where the keyboard is, always visible; never for a mouse click */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@keyframes pulse { 50% { opacity: 0.3; } }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── the header: three places and one action ────────────────────────────── */

.top {
  height: var(--top); display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 7px; font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand .logo { color: var(--accent); }
.brand small { font-weight: 500; color: var(--muted); font-size: 13px; letter-spacing: 0; }
/* (a host app that puts a header of its own over the Studio's stylesheet writes `.top nav` too) */
.top nav { display: flex; gap: 4px; margin-left: 8px; }
.top nav a {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 19px;
  color: var(--muted); font-weight: 600; font-size: 15px; transition: background 120ms, color 120ms;
}
.top nav a:hover { background: var(--sunk); color: var(--text); text-decoration: none; }
.top nav a.on { color: var(--accent); background: var(--accent-soft); }
.top .context { display: flex; align-items: center; gap: 10px; min-width: 0; padding-left: 14px; border-left: 1px solid var(--line); }

/* someone is needed: on every page until nobody is */
.needs {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; white-space: nowrap;
  font-weight: 600; font-size: 14px; color: var(--warn); background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
}
.needs:hover { text-decoration: none; border-color: var(--warn); }
.needs .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 1.4s infinite; }

/* what this page is about, and what can be done to it */
.subbar {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 20px; flex-wrap: wrap;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.subbar h1 { font-size: 19px; }
.subbar .back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; font-size: 14px; padding-right: 12px; border-right: 1px solid var(--line); }
.subbar .back:hover { color: var(--text); text-decoration: none; }
.subbar .ver { font: 14px var(--mono); color: var(--muted); }
.versions select { width: auto; padding: 5px 8px; font-size: 14px; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; font-size: 15px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--line-strong); }
.crumbs .here { font: 600 15px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.crumbs .ver { color: var(--muted); font: 14px var(--mono); }
.facts-inline { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ── controls ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  font: 600 14px var(--sans); border-radius: var(--r); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); transition: border-color 120ms, background 120ms;
}
.btn:hover:not(:disabled) { border-color: var(--muted); text-decoration: none; background: var(--sunk); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); background: var(--bad-soft); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; gap: 5px; }
.btn.small .icon, .chip .icon, .pill .icon { width: 15px; height: 15px; }
.btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; border-radius: var(--r); cursor: pointer;
  border: 1px solid transparent; background: none; color: var(--muted);
}
.icon-btn:hover { background: var(--sunk); color: var(--text); border-color: var(--line); }
.icon-btn .icon { width: 16px; height: 16px; }
button.plain { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; border-radius: 6px; }
button.plain.on { box-shadow: 0 0 0 2px var(--accent); }

input[type="text"], input[type="search"], input[type="number"], input[type="password"], textarea, select {
  font: 15px var(--sans); color: var(--text); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--r); padding: 8px 11px; width: 100%;
}
textarea { line-height: 1.5; resize: vertical; }
textarea.mono, input.mono { font: 13.5px/1.5 var(--mono); }
/* code keeps its lines: it scrolls sideways rather than wrap */
textarea.mono { white-space: pre; overflow-x: auto; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input:disabled, textarea:disabled, select:disabled { background: var(--sunk); color: var(--muted); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; font: 600 12px var(--sans); letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap;
  padding: 2px 9px; border-radius: 99px; background: var(--sunk); color: var(--muted); border: 1px solid var(--line);
}
.b-ok, .b-valid, .b-pass { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.b-frozen { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.b-error, .b-violated, .b-fail { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.b-running, .b-waiting, .b-starting, .b-paused, .b-generated, .b-improved, .b-draft { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.b-running::before, .b-waiting::before { content: "●"; margin-right: 6px; font-size: 9px; animation: pulse 1.2s infinite; }

/* a chip names a thing; one that can be pressed says so */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font: 13px var(--mono); padding: 2px 9px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--sunk); color: var(--text); white-space: nowrap; margin: 1px 2px 1px 0;
}
button.chip { cursor: pointer; height: 30px; padding: 0 12px; margin: 0; }
button.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button.chip:disabled { opacity: 0.5; cursor: default; }
.chip.on, button.chip.on:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.add { border-style: dashed; color: var(--muted); background: none; }
.chip.spec { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-soft); }
.chip .n, .tabs .n, .seg .n { font: 600 12px var(--mono); opacity: 0.75; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* a switch with two or three positions */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--sunk); border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; border: 0; border-radius: 7px; background: none; cursor: pointer;
  padding: 0 11px; font: 600 13px var(--sans); color: var(--muted); white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px var(--shade), 0 0 0 1px var(--line); }
.seg svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seg.icons button { padding: 0 8px; }

/* the shelves of a list */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 0; }
.tabs button, .tabs a.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border: 0; background: none; cursor: pointer;
  font: 600 15px var(--sans); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover, .tabs a.tab:hover { color: var(--text); text-decoration: none; }
.tabs button.on, .tabs a.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.runs-wrap { margin-top: 16px; }
.group.first { margin-top: 0; margin-bottom: 28px; }

.search { position: relative; display: flex; align-items: center; width: 360px; max-width: 100%; }
.search .icon { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; height: 40px; }

.note { margin: 10px 0; padding: 9px 12px; border-radius: var(--r); font-size: 14px; background: var(--sunk); border-left: 3px solid var(--line-strong); }
.note.warn { background: var(--warn-soft); border-left-color: var(--warn); }
.note.bad { background: var(--bad-soft); border-left-color: var(--bad); color: var(--text); }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--R); }
.link { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 14px; }
.link .icon { width: 15px; height: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; margin-top: 8px; }
.row.actions { margin-top: 12px; }

/* ── pages: home, the lists ─────────────────────────────────────────────── */

.page { max-width: 1160px; margin: 0 auto; padding: 28px 24px 80px; }
.page.wide { max-width: 1440px; }
.headbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.group { margin-top: 32px; }
.page > .group:first-child { margin-top: 0; }
.about { color: var(--muted); margin: 12px 0; }

.hero {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px 32px 24px; box-shadow: 0 1px 2px var(--shade);
  background-image: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 55%);
}
.hero h1 { font-size: 28px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); max-width: 760px; margin: 8px 0 16px; }
.hero .lead { font-size: 16px; margin-bottom: 18px; }
.ask-box { border: 1px solid var(--line-strong); border-radius: var(--R); background: var(--panel); box-shadow: 0 1px 2px var(--shade); }
.ask-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-box textarea { border: 0; background: none; font-size: 16px; padding: 14px 16px 6px; resize: none; }
.ask-box textarea:focus { outline: 0; }
.ask-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px 16px; flex-wrap: wrap; }
/* how an agent comes to be: the same five words the workbench uses */
.path { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); }
.path li { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.path b { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.path i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 600 12px var(--mono); background: var(--accent-soft); color: var(--accent); }

.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 24px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--R); box-shadow: 0 1px 2px var(--shade);
}
a.card:hover { text-decoration: none; border-color: var(--line-strong); }
.card.slim { padding: 14px 16px; gap: 8px; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card + .card { margin-top: 16px; }
.cols > .card + .card { margin-top: 0; }
.card h2 .hint, .card h3 .hint { margin-left: 6px; }
.card-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ask-card { border-left: 4px solid var(--warn); }
.ask-card:hover { border-color: var(--warn); }
.card .top-line, .tile .top-line { display: flex; align-items: center; gap: 8px; }
.card .q { font-weight: 600; }
.card .go { color: var(--accent); font-weight: 600; font-size: 14px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--R); box-shadow: 0 1px 2px var(--shade); overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px; padding: 11px 14px; color: var(--text); }
.list a:hover { background: var(--sunk); text-decoration: none; }
.list .mono { font-weight: 600; }
.list .desc { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* a tile: one thing to open or to start from */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tiles.big { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-top: 6px; }
.tile {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; color: var(--text); min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--R); box-shadow: 0 1px 2px var(--shade); transition: border-color 120ms, transform 120ms;
}
a.tile:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.tile b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.tile .about { margin: 0; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .actions { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }

/* what a definition is made of: a square per state, in the colour of its kind */
.shape { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.shape i { width: 11px; height: 11px; border-radius: 3px; background: var(--tone, var(--muted)); }
.shape .n { margin-left: 6px; font-size: 13px; color: var(--muted); }
.t-llm { --tone: var(--llm); } .t-tool { --tone: var(--tool); } .t-gate { --tone: var(--gate); }
.t-mem { --tone: var(--mem); } .t-team { --tone: var(--team); } .t-human { --tone: var(--human); }
.t-web { --tone: var(--web); } .t-flow { --tone: var(--accent); } .t-base { --tone: var(--muted); } .t-end { --tone: var(--line-strong); }

/* a memory, in the colour of its type's family */
.f-conversation { --fam: var(--f-conversation); } .f-lookup { --fam: var(--f-lookup); } .f-record { --fam: var(--f-record); }
.f-shared { --fam: var(--f-shared); } .f-own { --fam: var(--f-own); }
.mtype {
  display: inline-flex; align-items: center; gap: 6px; font: 13px var(--mono); padding: 2px 9px; border-radius: 6px; white-space: nowrap; margin: 1px 3px 1px 0;
  color: var(--fam, var(--mem)); background: color-mix(in srgb, var(--fam, var(--mem)) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--fam, var(--mem)) 28%, transparent);
}
.mtype b { color: var(--text); font-weight: 600; }

/* the registry as a sheet: one row a definition, everything about it across */
.facets { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.facets .chip { font: 500 14px var(--sans); }
.sheet-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--R); box-shadow: 0 1px 2px var(--shade); overflow-x: auto; }
table.sheet { width: 100%; border-collapse: collapse; }
.sheet th {
  text-align: left; font: 600 12px var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--sunk); white-space: nowrap; position: sticky; top: 0;
}
.sheet td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.sheet tbody tr:first-child td { border-top: 0; }
.sheet tbody tr[phx-click] { cursor: pointer; }
.sheet tbody tr[phx-click]:hover { background: var(--sunk); }
.sheet .who { min-width: 260px; max-width: 420px; }
.sheet-wrap.keys { margin-top: 16px; }
form.keep input { width: auto; }
form.keep input[name="name"] { flex: 0 1 300px; min-width: 0; }
form.keep input[name="password"] { flex: 1 1 220px; min-width: 0; }
.hint.end { margin-left: 6px; white-space: nowrap; }
.sheet td.acts { text-align: right; white-space: nowrap; }
.sheet td.acts .btn + .btn { margin-left: 6px; }
.sheet .who .name { display: block; font: 600 15px var(--mono); }
.sheet .who .about { display: block; margin: 2px 0 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .ver { white-space: nowrap; } .sheet .ver > * { margin-right: 6px; }
/* The agents: every column has its width and the first has what is left, so that how a row
   stands — its last run, its evals — is in sight on a laptop's screen without scrolling the
   sheet sideways; what an agent is for is cut short before that. */
table#agents { table-layout: fixed; min-width: 1230px; }
table#agents th:nth-child(2) { width: 222px; } table#agents th:nth-child(3) { width: 140px; } table#agents th:nth-child(4) { width: 266px; }
table#agents th:nth-child(5) { width: 80px; } table#agents th:nth-child(6) { width: 112px; } table#agents th:nth-child(7) { width: 116px; }
table#agents th:nth-child(8) { width: 74px; }
table#agents .who { min-width: 0; max-width: none; } table#agents .ver { white-space: normal; }
table#agents .who .about { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sheet .num, .sheet th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet .lastrun { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sheet.plain td { padding: 9px 12px; }
/* the runs list: fixed columns, one line each — the full text is in the tooltip and on the run's page */
table.runs { table-layout: fixed; }
table.runs .c-status { width: 124px; } table.runs .c-name { width: 250px; } table.runs .c-num { width: 100px; }
table.runs .c-use { width: 160px; } table.runs .c-when { width: 100px; }
table.runs td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.runs td.name { font: 600 14px var(--mono); }
table.runs td.desc, table.runs td.v { color: var(--muted); }

/* ── the workbench: one agent, step by step ─────────────────────────────── */

/* the steps, in three phases; the one looked at, and the next thing to do */
.steps { display: flex; align-items: stretch; gap: 18px; padding: 10px 20px 12px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.phase { display: flex; flex-direction: column; gap: 5px; }
.phase + .phase { padding-left: 18px; border-left: 1px solid var(--line); }
.phase-name { font: 600 12px var(--sans); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.phase-steps { display: flex; gap: 6px; }
.stage {
  display: flex; align-items: center; gap: 10px; min-width: 132px; max-width: 220px; height: 50px; padding: 0 12px 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); text-align: left; cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.stage:hover { border-color: var(--line-strong); background: var(--sunk); }
.stage .dot {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font: 600 12px var(--mono); color: var(--muted); border: 1.5px solid var(--line-strong); background: var(--panel);
}
.stage .what { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.stage .what b { font-size: 14px; font-weight: 600; }
.stage .what small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage.s-done .dot { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.stage.s-bad .dot { color: var(--panel); border-color: var(--bad); background: var(--bad); }
.stage.s-bad .what small { color: var(--bad); }
.stage.s-locked { color: var(--muted); }
/* the next thing to do is lit; the step looked at is framed */
.stage.next .dot { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.stage.next.s-bad .dot { background: var(--bad); border-color: var(--bad); color: var(--panel); }
.stage.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.stage.on .what b { color: var(--accent); }

@media (max-height: 800px) {
  .steps { padding-top: 7px; padding-bottom: 9px; } .phase { gap: 3px; } .stage { height: 44px; }
  .subbar { min-height: 48px; padding-top: 5px; padding-bottom: 5px; }
}

.notice { padding: 10px 20px; background: var(--accent-soft); font-size: 14px; border-bottom: 1px solid var(--line); }
.drafting { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 20px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 14px; }
.drafting b { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); }
.drafting ol { display: flex; gap: 6px 18px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; color: var(--muted); }
.drafting li::before { content: "○ "; }
.drafting li.done { color: var(--ok); } .drafting li.done::before { content: "✓ "; }
.drafting li.now { color: var(--text); font-weight: 600; } .drafting li.now::before { content: "● "; color: var(--accent); animation: pulse 1.2s infinite; }

.studio { min-height: calc(100vh - 220px); }
.work { padding: 20px; max-width: 1560px; margin: 0 auto; }
.cols { display: grid; gap: 20px; align-items: start; }
.cols.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols.main-aside { grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); }
.aside { display: flex; flex-direction: column; gap: 0; position: sticky; top: calc(var(--top) + 12px); max-height: calc(100vh - var(--top) - 24px); overflow: auto; }
.main > .card:first-child { margin-top: 0; }

/* a form: a label over each field, what it is for beside the label */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.form label { display: flex; flex-direction: column; gap: 5px; }
.form label > span { font-weight: 600; font-size: 14px; }
.form label > span i, label.tick i { font-style: normal; font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.form label.inline { flex-direction: row; align-items: center; gap: 10px; }
.form label.inline input, .form label.inline select { width: auto; }
.form input.short { width: 140px; }
label.tick { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
label.tick.wide { align-items: flex-start; }
details.more { margin-top: 10px; }
details.more > summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0; }
details.more > summary .hint { margin-left: 6px; }
details.more[open] > summary { margin-bottom: 8px; }

/* describe: the contract as rows of fields */
.contract { margin-top: 14px; }
.contract h3 { margin-bottom: 8px; }
.fields-head, .field-row { display: grid; grid-template-columns: minmax(110px, 1fr) 112px 56px minmax(120px, 1.6fr) 62px; gap: 8px; align-items: center; }
.fields-head { font: 600 12px var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 0 2px 4px; }
.field-row { margin-bottom: 6px; }
.field-row .tick { justify-content: center; }
.field-row.add { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }

/* properties: by kind, each in its colour */
.pk-invariant { --pk: var(--invariant); } .pk-safety { --pk: var(--safety); } .pk-liveness { --pk: var(--liveness); }
.pk-temporal { --pk: var(--temporal); } .pk-fairness { --pk: var(--fairness); }
.pgroup { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--pk); border-radius: var(--R); box-shadow: 0 1px 2px var(--shade); }
.pgroup > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.pgroup > header h3 { color: var(--pk); }
.kind-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--pk); background: color-mix(in srgb, var(--pk) 12%, transparent); }
.none-yet { margin: 0; padding: 0 16px 14px 56px; color: var(--muted); font-size: 14px; }
.prop { margin: 0 12px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
.prop > header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prop .says { margin: 8px 0 4px; font-size: 15px; }
.prop .holds { margin: 0 0 4px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.prop .holds code { font-size: 14px; background: var(--panel); padding: 2px 8px; }
.formal { font: 13px var(--mono); color: var(--muted); }
.prop .why { margin: 0; font-size: 13px; color: var(--muted); }
.prop.st-violated { border-color: var(--bad); background: var(--bad-soft); } .prop.st-violated .why { color: var(--bad); font-weight: 500; }
.prop.st-error { border-color: var(--bad); } .prop.st-error .why { color: var(--bad); }
.prop.st-warned .why { color: var(--warn); }
.prop .seen { margin: 6px 0 0; font-size: 13px; color: var(--ok); } .prop .seen.bad { color: var(--bad); }
/* how a property stands */
.pill { display: inline-flex; align-items: center; gap: 5px; font: 600 12px var(--sans); letter-spacing: 0.02em; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
.pill.st-proved { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.st-enforced { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.pill.st-warned { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.st-violated, .pill.st-error { color: var(--panel); background: var(--bad); border-color: transparent; }
.prop-form { margin: 0 12px 12px; padding: 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); display: flex; flex-direction: column; gap: 12px; }
.prop-form label { display: flex; flex-direction: column; gap: 5px; }
.prop-form label > span { font-weight: 600; font-size: 14px; } .prop-form label > span i { font-style: normal; font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.prop-form label.inline { flex-direction: row; align-items: center; gap: 8px; } .prop-form label.inline input, .prop-form label.inline select { width: auto; }
.patterns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.patterns .chip { font-family: var(--sans); }
.would { margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.would.st-violated, .would.st-error { color: var(--bad); }
.hint-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.hint-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.hint-row code { font-size: 13px; }
.kind-tag { font: 600 12px var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--pk, var(--tone, var(--muted))); }
.kind-tag.big { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: color-mix(in srgb, var(--tone, var(--muted)) 13%, transparent); }
.legend p { margin: 0; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.legend .pill { flex: none; min-width: 106px; justify-content: center; }

/* the machine */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
/* What the definition declares for its states to use, in a panel of its own under the bar: a
   row a kind, one under the other. A row begins with its name, how many there are and the
   button that adds one — in a column of their own, so they stand where they stood however
   much is declared — and what is declared wraps beside them, across the page. */
.declared {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: stretch; min-width: 0; padding: 2px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--R); box-shadow: 0 1px 2px var(--shade);
}
.work > .declared { margin-bottom: 14px; }
.toolbar:has(+ .declared) { margin-bottom: 10px; }
.toolbar > .declared { flex: 1 1 440px; }
.decl-row { display: contents; }
.decl-row + .decl-row > * { border-top: 1px solid var(--line); }
.decl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 6px 14px 6px 0; border-right: 1px solid var(--line); }
.declared .label { display: inline-flex; align-items: center; gap: 6px; height: 26px; font: 600 12px var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.declared .label .icon { width: 15px; height: 15px; }
.declared .label .n { min-width: 20px; padding: 0 6px; text-align: center; font: 600 12px/18px var(--mono); letter-spacing: 0; border-radius: 99px; color: var(--text); background: var(--sunk); border: 1px solid var(--line); }
.decl-head .btn.small { height: 26px; padding: 0 9px 0 6px; gap: 3px; }
.decl-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; padding: 6px 0 6px 14px; }
.decl-list .chip { height: 26px; margin: 0; }
.decl-list button.plain { display: inline-flex; }
.decl-list .mtype { margin: 0; height: 26px; }
.decl-list .none { font-size: 13px; line-height: 26px; }
/* beyond the first few, the rest is folded away until it is asked for */
.decl-row:not(.all) .extra, .decl-row:not(.all) .more-off, .decl-row.all .more-on { display: none; }
.decl-list .chip.more { border-style: dashed; background: none; color: var(--muted); font: 600 12px var(--sans); }

/* An event the definition declares: what a state says happened, for whoever follows the agent
   from outside. It has a mark of its own rather than a colour: it is not a kind of state. */
.t-event { --tone: var(--accent); }
.chip.event::before { content: "\2197"; margin-right: 5px; color: var(--accent); font-weight: 700; }
.chip.event.on::before { color: inherit; }
.inspect pre.schema, .inspect code.address {
  display: block; margin: 0; padding: 8px 10px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r);
  font-size: 13px; overflow: auto; max-height: 240px;
}
.inspect code.address { overflow-wrap: anywhere; }
.canvas { padding: 18px; overflow: auto; background: var(--sunk); text-align: center; }
.card.flush + .card.flush { margin-top: 16px; }
/* a card that holds a diagram clips its corners without becoming what its buttons stick to */
.card.flush.diagram { overflow: clip; }
.state-row {
  display: grid; grid-template-columns: 12px minmax(90px, max-content) max-content max-content minmax(0, 1fr) max-content; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; color: var(--text); font: inherit;
}
.state-row:first-of-type { border-top: 0; }
.state-row:hover { background: var(--sunk); }
.state-row.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.state-row .dot, .legend-kinds .dot { width: 11px; height: 11px; border-radius: 3px; background: var(--tone); }
.state-row .desc { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state-row .to { color: var(--muted); font: 13px var(--mono); white-space: nowrap; }
.start-tag { font: 600 12px var(--sans); color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 1px 8px; }
.legend-kinds { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.legend-kinds li { display: grid; grid-template-columns: 12px 64px 1fr; gap: 8px; align-items: center; }
.legend-kinds b { font: 600 13px var(--mono); color: var(--tone); } .legend-kinds span { color: var(--muted); }

/* the inspector: the state, tool or memory that is picked */
.inspect { border-top: 4px solid var(--tone, var(--fam, var(--line-strong))); }
.inspect-head { display: flex; align-items: center; gap: 10px; }
.rename { flex: 1; min-width: 0; }
.rename input { font: 600 16px var(--mono); padding: 5px 8px; border-color: transparent; background: none; }
.rename input:hover, .rename input:focus { border-color: var(--line-strong); background: var(--panel); }
.inspect .block { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.inspect h4 { margin-bottom: 8px; } .inspect h4 .hint { margin-left: 6px; }
.next-form { display: flex; flex-direction: column; gap: 6px; }
.next-row { display: flex; align-items: center; gap: 8px; }
.next-row .when { flex: none; min-width: 78px; font-size: 14px; color: var(--muted); }
.next-row .when.wide { flex: 1.3; display: flex; align-items: center; gap: 6px; min-width: 0; }
.next-row .arrow { color: var(--muted); flex: none; }
.next-row select { flex: 1; min-width: 90px; font: 14px var(--mono); padding: 6px 8px; }
.facts-list { margin: 4px 0; display: grid; gap: 6px; font-size: 14px; }
.facts-list div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; }
.facts-list dt { color: var(--muted); } .facts-list dd { margin: 0; } .facts-list dd i { font-style: normal; color: var(--muted); font-size: 13px; margin-left: 4px; }
.inspect > footer { padding-top: 12px; border-top: 1px solid var(--line); }

/* tools by phase */
.matrix th.tick-col, .matrix td.tick-col { text-align: center; width: 96px; }
.tick-btn {
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font: 700 16px var(--sans);
  border: 1.5px solid var(--line-strong); background: var(--panel); color: var(--accent-ink);
}
.tick-btn:hover:not(:disabled) { border-color: var(--accent); }
.tick-btn.on { background: var(--accent); border-color: var(--accent); }

/* functions */
.decl { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.decl:first-of-type { border-top: 0; }
.decl code, .example code { border: 0; background: none; padding: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.example { display: grid; grid-template-columns: 18px 1fr; gap: 2px 6px; padding: 7px 0; border-top: 1px solid var(--line); align-items: baseline; }
.example .mark { font-weight: 700; } .example.st-passed .mark { color: var(--ok); } .example.st-failed .mark { color: var(--bad); }
.example .got, .example .hint { grid-column: 2; font: 13px var(--mono); color: var(--muted); }
.example .got.bad { color: var(--bad); }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 8px; }
.cheat { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 5px; }

/* test, publish */
.runfields textarea { font-size: 15px; }
.runfields > .btn, .runform > .btn { align-self: flex-start; }
.report { margin-top: 4px; font-size: 14px; }
.score { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.case { border-top: 1px solid var(--line); padding: 8px 0; }
.case .line { font-weight: 600; display: flex; gap: 8px; }
.check { padding-left: 20px; font: 13.5px var(--mono); }
.case .given { font-weight: 400; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
/* the evals' failures, handed to the spec writer; what its fix changed */
.mend { margin-top: 12px; padding: 12px 14px; display: grid; gap: 10px; font-size: 14px; border-radius: var(--r); background: var(--accent-soft); border-left: 3px solid var(--accent); }
.mend p { margin: 0; }
.note ul { margin: 6px 0; padding-left: 20px; }
.note details.more { margin-top: 8px; }
.code.diff { font: 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.code.diff > * { display: block; text-decoration: none; }
.code.diff ins { color: var(--ok); background: var(--ok-soft); }
.code.diff del { color: var(--bad); background: var(--bad-soft); }
.run-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text); font-size: 14px; }
.run-row:first-of-type { border-top: 0; } .run-row:hover { text-decoration: none; color: var(--accent); }
.run-row .desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.lastrun { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 0; }
.held-row { display: grid; grid-template-columns: 44px 1fr; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.held-row .mark { font: 600 13px var(--mono); color: var(--ok); } .held-row .mark.bad { color: var(--bad); } .held-row a { grid-column: 2; font-size: 13px; }
.held-row .what { display: flex; flex-direction: column; } .held-row .what span { color: var(--muted); }
.ready { list-style: none; margin: 4px 0 6px; padding: 0; display: grid; gap: 8px; }
.ready li { display: grid; grid-template-columns: 26px auto 1fr; gap: 8px; align-items: baseline; }
.ready .mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 700; font-size: 13px; background: var(--sunk); color: var(--muted); border: 1.5px solid var(--line-strong); }
.ready li.done .mark { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.mem-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.publish h3 { margin-top: 10px; }
/* … when the agent starts by itself, and what waits for its time */
.times { list-style: none; margin: 4px 0 10px; padding: 0; display: grid; gap: 6px; }
.times li, .wait-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.times .icon { color: var(--muted); }
.wait-row { padding: 7px 0; border-top: 1px solid var(--line); }
.waits .wait-row:first-of-type { border-top: 0; }
#feed .chips { margin: 0 0 10px; }
.work > .cols + .card { margin-top: 20px; }

/* ── the picker: the kit's pieces, where one is being added ─────────────── */

.scrim { position: fixed; inset: 0; background: rgb(10 12 18 / 0.45); z-index: 40; }
.picker {
  position: fixed; z-index: 41; top: 8vh; left: 50%; transform: translateX(-50%); width: min(720px, calc(100vw - 32px)); max-height: 82vh;
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 24px 64px var(--shade-up);
}
.picker > header { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 10px 20px; }
.picker h2 { flex: 1; font-size: 18px; }
.picker h2 small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 3px; letter-spacing: 0; }
.picker .search { width: auto; margin: 0 16px 10px; }
.picker .search input { height: 44px; font-size: 16px; }
.picker-body { overflow: auto; padding: 0 16px 16px; }
.pieces { margin-top: 10px; }
.pieces > h3 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font: 600 12px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fam, var(--muted)); padding: 8px 4px 6px; }
.pieces > h3 .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.piece { border-radius: 10px; border: 1px solid var(--line); border-left: 4px solid var(--fam, var(--tone, var(--line-strong))); background: var(--panel); margin-bottom: 6px; }
.piece-main {
  display: grid; grid-template-columns: 176px 1fr auto; align-items: center; gap: 4px 12px; width: 100%; padding: 10px 12px;
  border: 0; background: none; text-align: left; color: var(--text); font: inherit; border-radius: 8px;
}
button.piece-main { cursor: pointer; }
button.piece-main:hover:not(:disabled) { background: var(--accent-soft); }
button.piece-main:disabled { cursor: default; }
.piece-title { font: 600 15px var(--mono); color: var(--fam, var(--tone, var(--text))); }
.piece-doc { font-size: 14px; color: var(--muted); }
.piece-tag { font: 600 13px var(--sans); color: var(--accent); white-space: nowrap; }
.piece.s-present .piece-tag { color: var(--ok); }
.piece.s-blocked .piece-tag { color: var(--warn); font-weight: 400; white-space: normal; max-width: 220px; text-align: right; }
.piece.s-blocked .piece-title, .piece.s-blocked .piece-doc { opacity: 0.6; }
.options { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; max-height: 148px; overflow: auto; }
.options .chip.s-present { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ── the text: the source, the checker, the views beside it ─────────────── */

/* A page that is one working surface — the text and what stands beside it, a library, a run —
   is as tall as the window: its bars take what they need (one row or two, a notice or none),
   the surface takes the rest, and what is in it scrolls there. */
[data-phx-main]:has(> main.studio.at-yaml), [data-phx-main]:has(> main.studio.lib), [data-phx-main]:has(> main.run) { display: flex; flex-direction: column; height: 100vh; }
[data-phx-main] > main.studio.at-yaml, [data-phx-main] > main.studio.lib { flex: 1 1 0; min-height: 440px; display: flex; flex-direction: column; }
/* two panes, and between them a bar to drag (`Split`): the text is as wide as the person left it */
.work.yaml { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, var(--split-yaml, 1.5fr)) 16px minmax(320px, 1fr); padding: 16px 20px; max-width: none; width: 100%; }

/* a bar between two panes: dragged, it gives one of them more room (`Split` in app.js) */
.split { position: relative; z-index: 3; cursor: col-resize; touch-action: none; user-select: none; }
.split::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; border-radius: 2px; background: transparent; transition: background 120ms; }
.split:hover::before, .split:focus-visible::before, .split[data-held]::before { background: var(--accent); }
.split:focus-visible { outline: none; }
:root[data-splitting] { cursor: col-resize; user-select: none; }
:root[data-splitting] iframe, :root[data-splitting] .edit-view { pointer-events: none; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--R); overflow: auto; min-width: 0; display: flex; flex-direction: column; box-shadow: 0 1px 2px var(--shade); }
.pane > * { flex-shrink: 0; }
.pane > header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; min-height: 50px; flex-wrap: wrap; }
/* what a header says about its pane has the room that is left, and is cut short before the header takes a second row */
.pane > header > .hint { flex: 100 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* which step the inspector speaks of: said where it says what it shows */
.ctx .hint .at { color: var(--text); font: 600 13px var(--mono); white-space: nowrap; }
.src { flex: 1; display: flex; min-height: 240px; }
.src > .edit { flex: 1; }
.src textarea { flex: 1; border: 0; border-radius: 0; resize: none; padding: 14px 16px; background: var(--sunk); tab-size: 2; font: 14px/1.55 var(--mono); }
.src textarea:focus { outline: 0; }
.work.fns .pane.editor { min-height: 520px; }
.checks { border-top: 1px solid var(--line); padding: 10px 16px; font-size: 14px; max-height: 220px; overflow: auto; }
.checks .fine { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 500; }
.checks .found { display: flex; align-items: center; gap: 12px; color: var(--bad); margin-bottom: 4px; }
.problem { color: var(--bad); font: 13.5px/1.5 var(--mono); padding: 3px 0; white-space: pre-wrap; }
.editor:has(.rich) .problem[data-problem] { cursor: pointer; }
.editor:has(.rich) .problem[data-problem]:hover { text-decoration: underline; }

.edit { display: flex; flex-direction: column; min-width: 0; position: relative; }
.edit > textarea { flex: 1; font: 14px/1.55 var(--mono); }
.edit.rich > textarea { display: none; }
.edit-view { flex: 1; min-height: 0; overflow: hidden; }
.edit.sub { flex: 1; min-height: 0; }
/* an editor that is a field of a form: as tall as what is in it */
.edit[data-grow] { border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--sunk); }
.edit[data-grow] > textarea { border: 0; border-radius: 0; background: var(--sunk); }
.edit[data-grow] .edit-view { flex: none; }
.edit-bar { display: flex; align-items: center; gap: 8px; padding: 5px 12px; min-height: 40px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 14px; }
.edit-bar button, .edit-bar select { font: 600 13px var(--sans); height: 30px; padding: 0 10px; border-radius: 7px; cursor: pointer; width: auto; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.edit-bar .tabs { display: flex; gap: 2px; border: 0; margin: 0; }
.edit-bar .tabs button { border: 1px solid transparent; color: var(--muted); height: 30px; margin: 0; }
.edit-bar .tabs button.on { background: var(--sunk); color: var(--text); border-color: var(--line); }
.edit-bar .say { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-bar .say.ok { color: var(--ok); } .edit-bar .say.bad { color: var(--bad); }
/* what the editor draws on the text: a {{hole}} is code inside a string; a piece that just landed glows */
.monaco-editor .hole { color: var(--gate) !important; background: color-mix(in srgb, var(--gate) 12%, transparent); border-radius: 3px; }
.monaco-editor .placed { background: var(--accent-soft); animation: landed 1.6s ease-out forwards; }
/* the value Lean gave for an #eval, written after its line */
.monaco-editor .eval { color: var(--ok); opacity: 0.85; font-style: italic; }
@keyframes landed { 60% { background: var(--accent-soft); } 100% { background: transparent; } }

/* beside the text: one view at a time, chosen with tabs that look like the editor's */
.views .tabs { gap: 2px; border: 0; margin: 0; }
.views .tabs button { height: 30px; padding: 0 10px; margin: 0; border: 1px solid transparent; border-radius: 7px; font: 600 13px var(--sans); }
.views .tabs button.on { background: var(--sunk); color: var(--text); border-color: var(--line); }
.views > header > [inert] { visibility: hidden; }
.views > .view { min-height: 0; }
.views > .view.fill { flex: 1; display: flex; min-height: 260px; }
.views > .view.fill > .jc { flex: 1; }
.views > .view.machine { flex-direction: column; }
.views > .view.machine > .zoom { flex: 1; }
/* the machine in a small window over the document's graph: an overview that fits it, and folds away */
.views > .view.fill { position: relative; }
.mini { position: absolute; top: 12px; right: 12px; z-index: 3; width: fit-content; min-width: 170px; max-width: min(280px, 44%); overflow: hidden; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--R); box-shadow: 0 8px 24px var(--shade-up); }
.mini > header { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; }
.mini > header b { flex: 1; font: 600 12px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mini > header button { height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); font: 600 12px var(--sans); cursor: pointer; }
.mini > header button:hover { border-color: var(--muted); }
/* of its two buttons the one that leads to the other state shows */
.mini > header button[aria-pressed="true"] { display: none; }
.mini > .canvas { padding: 8px; border-top: 1px solid var(--line); }
.mini svg.fsm { display: block; margin: 0 auto; max-height: min(28vh, 230px); }
/* (seen from far it shows the names only: the rule is the frame's, further down) */
:root[data-mini="shut"] .mini { min-width: 0; }
:root[data-mini="shut"] .mini > .canvas { display: none; }
.outline { padding: 4px 8px 14px; display: flex; flex-direction: column; }
.symbol { display: flex; align-items: baseline; gap: 6px; padding: 5px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font: 13.5px var(--mono); text-align: left; cursor: pointer; }
.symbol:hover { background: var(--sunk); }
.symbol .k { color: var(--accent); }

/* ── the state machine ──────────────────────────────────────────────────── */

svg.fsm { max-width: 100%; height: auto; font-family: var(--sans); overflow: visible; }
/* each state takes the colour of its kind's family */
.fsm .node { --tone: var(--muted); cursor: pointer; }
.fsm .k-llm { --tone: var(--llm); } .fsm .k-tools, .fsm .k-tool { --tone: var(--tool); } .fsm .k-gate { --tone: var(--gate); }
.fsm .k-memory { --tone: var(--mem); } .fsm .k-agent, .fsm .k-map, .fsm .k-par { --tone: var(--team); }
.fsm .k-human { --tone: var(--human); } .fsm .k-search { --tone: var(--web); }
.fsm .node rect { fill: color-mix(in srgb, var(--tone) 6%, var(--panel)); stroke: color-mix(in srgb, var(--tone) 55%, var(--panel)); stroke-width: 1.5; transition: stroke 120ms, fill 120ms; }
.fsm .node:hover rect { stroke: var(--tone); }
.fsm .node .name { font: 600 14px var(--mono); fill: var(--text); }
.fsm .node .kind { font: 600 12px var(--sans); letter-spacing: 0.05em; text-transform: uppercase; fill: var(--tone); }
.fsm .node .count { font: 600 12px var(--mono); fill: var(--muted); }
.fsm .node.terminal { --tone: var(--muted); }
.fsm .node.terminal rect { fill: var(--sunk); stroke: var(--line-strong); }
.fsm .node.visited rect { fill: color-mix(in srgb, var(--tone) 14%, var(--panel)); }
.fsm .node.selected rect { stroke: var(--tone); stroke-width: 3; }
.fsm .node.current rect { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 3; animation: pulse 1.2s infinite; }
/* where the machine starts: a dot and an arrow, as in a statechart */
.fsm .start circle { fill: var(--text); }
.fsm .start path { stroke: var(--text); stroke-width: 1.5; fill: none; }
.fsm .edge path { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linejoin: round; }
.fsm .edge.back path { stroke-dasharray: 4 3; }
.fsm .edge.err path { stroke: var(--bad); stroke-dasharray: 2 3; }
.fsm .edge text { font: 12px var(--mono); fill: var(--muted); paint-order: stroke; stroke: var(--sunk); stroke-width: 3px; }
.fsm .edge .plate { fill: var(--sunk); }
.fsm .head { fill: var(--muted); }
/* a path a property speaks of */
.fsm .node.trail rect { stroke: var(--bad); stroke-width: 3; fill: var(--bad-soft); }
.fsm .edge.trail path { stroke: var(--bad); stroke-width: 2.6; stroke-dasharray: none; }
/* every connection is drawn both ways: the one picked shows (html[data-edges]) */
.fsm .edge path.straight, :root[data-edges="straight"] .fsm .edge path.curved { display: none; }
:root[data-edges="straight"] .fsm .edge path.straight { display: inline; }

/* ── a diagram in a viewport of its own (Meta.View.Graph.frame/1; `Zoom` in app.js) ───────── */

/* the pane and its buttons share one cell: the buttons lie over the corner of the pane, and
   stay in sight at the foot of the window while a frame taller than it scrolls by */
.zoom { position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--sunk); }
.zoom-pane { grid-area: 1 / 1; display: flex; min-width: 0; min-height: 0; overflow: auto; padding: 18px; }
/* (with its buttons shown, the diagram ends above them: nothing of it is left under the buttons) */
.zoom[data-on] .zoom-pane { padding-bottom: 52px; }
.zoom-pane:focus-visible { outline-offset: -3px; }
.zoom-pane > svg.fsm { flex: none; margin: auto; }
/* with the script, the diagram is as large as it says: --w its own width, --k how close */
.zoom[data-on] .zoom-pane > svg.fsm { max-width: none; width: calc(var(--w) * var(--k) * 1px); user-select: none; }
.zoom[data-pan] .zoom-pane { cursor: grab; }
.zoom[data-pan="on"] .zoom-pane, .zoom[data-pan="on"] .fsm .node { cursor: grabbing; }
/* seen from far, the names only, as large as a state has room for: its colour says its kind */
.zoom[data-far] .fsm .edge text, .zoom[data-far] .fsm .plate, .zoom[data-far] .fsm .node .kind, .zoom[data-far] .fsm .node .count,
.mini.far .fsm .edge text, .mini.far .fsm .plate, .mini.far .fsm .node .kind { display: none; }
.zoom[data-far] .fsm .node .name, .mini.far .fsm .node .name { font-size: 20px; transform: translateY(9px); }
.zoom-ctl {
  grid-area: 1 / 1; align-self: end; justify-self: end; position: sticky; bottom: 10px; z-index: 2; margin: 0 10px 10px 0;
  display: none; align-items: center; gap: 1px; padding: 3px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 10px var(--shade);
}
.zoom[data-on] .zoom-ctl { display: inline-flex; }
.zoom-ctl button {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 5px; border: 0; border-radius: 7px;
  background: none; color: var(--muted); cursor: pointer; font: 600 12px var(--mono); font-variant-numeric: tabular-nums;
}
.zoom-ctl button:hover { background: var(--sunk); color: var(--text); }
.zoom-ctl button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.zoom-ctl svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.zoom-ctl .zoom-pct { min-width: 46px; }
.zoom-ctl .zoom-shut, .zoom[data-max] .zoom-ctl .zoom-open, .zoom-hint { display: none; }
.zoom[data-max] .zoom-ctl .zoom-shut { display: block; }
/* over the whole window: in the browser's top layer where it has one, else simply on top */
.zoom[data-max] {
  position: fixed; inset: 0; z-index: 1000; width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: var(--sunk); color: var(--text); overflow: hidden;
}
.zoom[data-max] .zoom-pane { padding: 32px 32px 68px; }
.zoom[data-max] .zoom-ctl { margin: 0 16px 16px 0; padding: 4px; }
.zoom[data-max] .zoom-ctl button { min-width: 32px; height: 32px; }
.zoom[data-max] .zoom-hint { display: inline; padding: 0 10px 0 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.zoom::backdrop { background: var(--sunk); }
:root[data-zoomed] body { overflow: hidden; }
/* a small one, beside what speaks of it: as tall as its diagram, up to a limit */
.zoom.small:not([data-max]) { height: min(340px, calc(var(--h) * 1px + 56px)); border-radius: var(--r); border: 1px solid var(--line); }
.zoom.small:not([data-max]) .zoom-pane { padding: 10px 10px 44px; }
.zoom.small:not([data-max]) .zoom-ctl { margin: 0 6px 6px 0; }
.zoom.small:not([data-max]) .zoom-pct { display: none; }

/* ── a run: the machine, the trace, the inspector ───────────────────────── */

.run {
  flex: 1 1 0; min-height: 420px; display: grid; background: var(--line);
  grid-template-columns: minmax(300px, var(--split-run-a, 0.9fr)) 1px minmax(380px, 1.4fr) 1px minmax(320px, var(--split-run-b, 1fr));
}
/* its bars are the lines between its panes: a hair wide, and easy to take hold of */
.run > .split::after { content: ""; position: absolute; top: 0; bottom: 0; left: -5px; right: -5px; }
.run > .split::before { width: 3px; margin-left: -1.5px; border-radius: 0; }
.run .pane { border: 0; border-radius: 0; box-shadow: none; }
.run .pane > header h2 { font: 600 12px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
/* the machine has what its pane has left; what went in and came out is under it, and scrolls by itself */
.run .diagram > .zoom:not([data-max]) { flex: 1 1 0; min-height: 240px; border-bottom: 1px solid var(--line); }
.run .diagram > .parts { flex: 0 1 auto; max-height: 42%; overflow: auto; }
.parts, .picked, .ctx { padding: 12px 16px; }
.part, .mem { margin-bottom: 16px; }
.parts h3, .picked h3, .ctx h3 { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 6px; }
.ctx h3 .hint, .parts h3 .hint { text-transform: none; letter-spacing: 0; }
.kid { display: block; padding: 4px 0; }
.run .tabs { margin: 0; border: 0; gap: 2px; }
.run .tabs button { height: 32px; padding: 0 8px; font: 600 12px var(--sans); letter-spacing: 0.04em; text-transform: uppercase; border: 0; border-radius: 7px; margin: 0; }
.run .tabs button.on { background: var(--sunk); color: var(--text); }

.timeline { background: var(--sunk); }
.timeline .step { margin: 12px 14px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.timeline .step:last-of-type { margin-bottom: 14px; }
.timeline .step.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.timeline .step > header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.step .n { font: 600 13px var(--mono); color: var(--muted); min-width: 20px; }
.step .state { font: 600 15px var(--mono); }
.step .kind { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.kind.k-llm { color: var(--llm); } .kind.k-tools, .kind.k-tool { color: var(--tool); } .kind.k-gate { color: var(--gate); }
.kind.k-memory { color: var(--mem); } .kind.k-agent, .kind.k-map, .kind.k-par { color: var(--team); } .kind.k-human { color: var(--human); }
.kind.k-search { color: var(--web); }
.timeline .step > footer { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.timeline .step > footer b { font-family: var(--mono); color: var(--text); }
.step .arrow { color: var(--accent); }
.step .why { font: 13px var(--mono); margin-left: 8px; }
.log { padding: 3px 14px; font: 13px var(--mono); color: var(--muted); }
/* what a step said happened (`emit:`) */
.emitted { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; padding: 4px 14px; font-size: 14px; color: var(--muted); }
.emitted .mark { color: var(--accent); font-weight: 700; }
.emitted b { color: var(--text); }
.emitted code { font-size: 13px; overflow-wrap: anywhere; }
.emitted .sent { font: 600 12px var(--mono); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.emitted .sent.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.emitted .sent.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.emitted .sent.going { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

.fx { border-top: 1px solid var(--line); }
.fx .line { display: flex; align-items: baseline; gap: 8px; padding: 8px 14px; cursor: pointer; }
.fx .line:hover { background: var(--sunk); }
.fx .caret { color: var(--muted); font-size: 11px; width: 10px; }
.fx .op { font: 600 13.5px var(--mono); }
.fx .brief { font: 13px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx .ms { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.fx .spin { font-size: 12px; color: var(--warn); animation: pulse 1.2s infinite; white-space: nowrap; }
.fx.failed .op { color: var(--bad); }
.fx.par { padding: 8px 14px 8px 32px; display: flex; gap: 8px; align-items: baseline; }
.fx .peek { padding: 0 14px 10px 32px; font: 13.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 136px; overflow: hidden; color: var(--text); }
.fx.failed .peek { color: var(--bad); }
.fx .body { padding: 2px 14px 14px 32px; }
.fx .body h4 { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 14px 0 6px; }
.fx .body h4 .hint { text-transform: none; letter-spacing: 0; margin-left: 6px; }
.facts { display: flex; gap: 14px; font: 13px var(--mono); color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
/* web search results: a link each, its address, its snippet */
.fx .answer { margin: 0 0 8px; padding: 8px 12px; border-left: 3px solid var(--web); background: var(--sunk); white-space: pre-wrap; }
.hits { margin: 0; padding-left: 24px; font-size: 14px; }
.hits li { margin-bottom: 10px; }
.hits li::marker { font: 600 12px var(--mono); color: var(--muted); }
.hits a { font-weight: 600; }
.hits .url { font: 13px var(--mono); color: var(--web); overflow-wrap: anywhere; }
.hits p { margin: 2px 0; color: var(--text); }
.final { margin: 14px; padding: 12px 14px; border-radius: 10px; font-weight: 600; background: var(--ok-soft); color: var(--ok); }
.final.error, .final.violated, .final.stopped { background: var(--bad-soft); color: var(--bad); }
.final.paused { background: var(--warn-soft); color: var(--warn); }
.final.paused .verdict .icon { background: var(--warn); }
.final .verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.final .verdict .icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; background: var(--ok); color: var(--panel); stroke: none; }
.final.error .verdict .icon, .final.violated .verdict .icon, .final.stopped .verdict .icon { background: var(--bad); }
.final .verdict span:not(.icon):not(.grow) { font-weight: 500; opacity: 0.85; }
.final .code { margin-top: 8px; }
.callout { display: block; margin: 12px 14px 0; padding: 11px 14px; border-radius: 10px; font-size: 14px; color: var(--text); border: 1px solid var(--line); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.callout.warn b { color: var(--warn); }
.callout:hover { text-decoration: none; border-color: var(--warn); }

.code { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; max-height: 340px; overflow: auto; }
.code.bad { color: var(--bad); border-color: var(--bad); }
.code.out { max-height: 260px; }

/* a conversation: the context window */
.ctxwin { display: flex; flex-direction: column; gap: 8px; }
.msg { border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: var(--r); padding: 8px 12px; background: var(--panel); }
.msg .role { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 3px; }
.msg pre { max-height: 320px; overflow: auto; }
.msg.system { border-left-color: var(--mem); background: var(--sunk); }
.msg.user { border-left-color: var(--team); }
.msg.assistant { border-left-color: var(--llm); }
.msg.tools { border-left-color: var(--tool); background: var(--sunk); }
.msg.live { border-style: dashed; }
.block + .block { margin-top: 6px; }
.tag { font: 12px var(--mono); color: var(--muted); background: var(--sunk); border-radius: 5px; padding: 1px 7px; margin-right: 4px; }
.block .tag { margin-bottom: 3px; display: inline-block; }
.tag.bad { color: var(--bad); }

/* typed decisions */
table.decide { width: 100%; border-collapse: collapse; font-size: 14px; }
table.decide td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.decide .k { font: 600 13.5px var(--mono); white-space: nowrap; }
table.decide .a { min-width: 170px; font-family: var(--mono); font-size: 13.5px; }
.bar { display: inline-block; width: 96px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar i { display: block; height: 100%; background: var(--gate); }
.dist { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dist span:first-child { min-width: 96px; }
table.found .a { min-width: 110px; }

/* a person is being asked */
.ask { margin: 4px 14px 14px 32px; padding: 14px; border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 10px; }
.ask .q { font-weight: 600; margin-bottom: 10px; white-space: pre-wrap; font-size: 15px; }
.ask .code { margin-bottom: 8px; }
.ask .text { flex: 1; min-width: 180px; }
.ask .value { margin-bottom: 8px; background: var(--sunk); }
.ask .refused { margin-top: 8px; color: var(--bad); font-size: 14px; }

.rec { border-top: 1px solid var(--line); padding: 6px 0; }
.event { border-top: 1px solid var(--line); padding: 5px 0; }
.event .type { font: 600 13.5px var(--mono); }

.json { font: 13.5px/1.5 var(--mono); }
.json details > summary { cursor: pointer; list-style: none; color: var(--muted); }
.json details > summary::before { content: "▸ "; font-size: 11px; }
.json details[open] > summary::before { content: "▾ "; }
.json .kids { padding-left: 14px; border-left: 1px solid var(--line); margin-left: 3px; }
.json .k { color: var(--accent); margin-right: 6px; }
.json .k::after { content: ":"; color: var(--muted); }
.json .s { color: var(--ok); }
.json pre.s { display: block; padding: 5px 9px; background: var(--sunk); border-radius: 5px; max-height: 280px; overflow: auto; margin: 2px 0; }
.json .v { color: var(--warn); }
.json .leaf { padding: 1px 0; }

/* ── a document as a graph (Meta.Site.Code.graph, after JSON Crack) ─────── */

.jc {
  position: relative; overflow: hidden; min-height: 240px; background-color: var(--sunk);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-position: -1px -1px; background-size: 100px 100px;
}
.jc-svg { display: block; width: 100%; height: 100%; position: absolute; inset: 0; cursor: grab; touch-action: none; user-select: none; }
.jc-svg.dragging { cursor: grabbing; }
.jc-svg.dragging * { pointer-events: none; }
.jc-view { transform-origin: 0 0; }
.jc.invalid .jc-view { opacity: 0.45; }
.jc-view.animate { transition: transform 250ms ease; }
.jc-edges path { fill: none; stroke: color-mix(in srgb, var(--muted) 65%, transparent); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.jc .node { cursor: pointer; }
.jc .node rect { fill: var(--panel); stroke: var(--line); stroke-width: 1; }
.jc .node:hover rect { stroke: var(--accent); }
.jc .node.selected rect { stroke: var(--accent); stroke-width: 2; }
.jc .fo { width: 100%; height: 100%; overflow: hidden; border-radius: 5px; pointer-events: none; color: var(--text); font: 500 12px var(--mono); }
.jc .fo .text { display: flex; align-items: center; height: 100%; padding: 0 10px; white-space: nowrap; overflow: hidden; }
.jc .fo .row { display: flex; align-items: center; height: 30px; padding: 3px 10px; line-height: 24px; white-space: nowrap; overflow: hidden; border-bottom: 1px solid var(--line); }
.jc .fo .row:last-child { border-bottom: none; }
.jc .fo .val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* a row that leads on ends with a mark: what hangs off it is shown (−) or folded away (+) */
.jc .fo .fold {
  flex: none; display: grid; place-items: center; width: 16px; height: 16px; margin: 0 -4px 0 6px; border-radius: 4px; font: 600 13px/1 var(--mono); font-style: normal;
  color: var(--muted); background: var(--sunk); border: 1px solid var(--line);
}
.jc .fo .fold.shut { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.jc .fo .highlight, .jc .node.selected .text { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.jc .k { color: var(--accent); }
.jc .v-str { color: var(--text); }
.jc .v-num { color: var(--warn); }
.jc .v-null { color: var(--muted); }
.jc .v-true { color: var(--ok); }
.jc .v-false { color: var(--bad); }
.jc .swatch { display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; border-radius: 3px; border: 1px solid var(--line); }
/* its buttons: the same ones, in the same corner, as a machine's (.zoom-ctl) */
.jc-controls {
  position: absolute; right: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 1px; padding: 3px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 10px var(--shade);
}
.jc-controls button { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 5px; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.jc-controls button:hover { background: var(--sunk); color: var(--text); }
.jc-controls svg { display: block; width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jc-controls .jc-shut, .jc.jc-max .jc-controls .jc-open, .jc-hint { display: none; }
.jc.jc-max .jc-controls .jc-shut { display: block; }
.jc-controls .jc-unfold, .jc.jc-folded .jc-controls .jc-fold { display: none; }
.jc.jc-folded .jc-controls .jc-unfold { display: block; }
.jc:focus-visible { outline-offset: -3px; }
/* over the whole window: in the browser's top layer where it has one, else simply on top */
.jc.jc-max { position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; color: var(--text); }
.jc.jc-max .jc-controls { right: 16px; bottom: 16px; padding: 4px; }
.jc.jc-max .jc-controls button { min-width: 32px; height: 32px; }
.jc.jc-max .jc-hint { display: inline; padding: 0 10px 0 8px; font: 13px var(--sans); color: var(--muted); white-space: nowrap; }
.jc::backdrop { background: var(--sunk); }
.jc-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: var(--sunk); color: var(--muted); }
.ctx.fill { flex: 1 1 0; min-height: 320px; display: flex; flex-direction: column; }
.ctx > .jc:not(.jc-max) { flex: 1 1 0; min-height: 240px; border: 1px solid var(--line); border-radius: var(--r); }

/* ── memory: what an agent remembers ────────────────────────────────────── */

/* where a record is in its life */
.life { display: inline-block; font: 600 12px var(--sans); letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; padding: 1px 8px; border-radius: 99px; background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
.life.l-live { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.life.l-stale, .life.l-proposed { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.life.l-retracted, .life.l-rejected { color: var(--bad); background: var(--bad-soft); border-color: transparent; }

/* a record: what it says, then who said it and what became of it */
.rrow { border-top: 1px solid var(--line); padding: 9px 0; }
.rrow .rline { display: flex; align-items: baseline; gap: 10px; cursor: pointer; }
.rrow .rline:hover .rsay { color: var(--accent); }
.rid { font: 600 13px var(--mono); color: var(--mem); white-space: nowrap; min-width: 30px; }
.rsay { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 15px; }
.rmeta { display: flex; flex-wrap: wrap; gap: 2px 12px; padding-left: 40px; font-size: 13px; color: var(--muted); }
.rmeta .rwhy { color: var(--text); }
.rmeta .rclash { color: var(--warn); font-weight: 600; }
/* what no longer stands reads as history */
.rrow.l-superseded .rline .rsay, .rrow.l-retracted .rline .rsay, .rrow.l-rejected .rline .rsay, .rrow.l-retired .rline .rsay { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.rrow.l-forgotten .rline .rsay { color: var(--muted); font-style: italic; }
.rmore { margin: 8px 0 4px 40px; padding: 10px 12px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); }
.rchain { margin-bottom: 8px; }
.rver { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; font-size: 14px; }
.rver .rsay { flex: 0 1 auto; font-size: 14px; }
.rver.this .rsay { font-weight: 600; }
.mmove { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.mmove input[type="text"] { flex: 1; min-width: 220px; }

/* a memory's log: one decision a line */
.mlog { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mlog .when { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.mlog .what { font: 600 13px var(--mono); min-width: 84px; color: var(--muted); }
.mlog .said { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.mlog .hint { flex-basis: 100%; }
.mlog.e-stored .what { color: var(--ok); }
.mlog.e-retracted .what, .mlog.e-forgotten .what { color: var(--bad); }
.mlog.e-moved .what { color: var(--warn); }

/* something to know about a memory or an op: what it did, what is wrong */
.mnote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--mem); border-radius: 0 var(--r) var(--r) 0; background: var(--sunk); font-size: 14px; }
.mnote.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.mnote.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.mtail { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 8px; }
.mdet { width: 100%; }
.mdet summary { cursor: pointer; font-size: 14px; }

/* each memory an agent declares, as a card in its family's colour */
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mcard {
  display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; cursor: pointer; color: var(--text); font: inherit;
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--fam, var(--mem)); border-radius: var(--R); box-shadow: 0 1px 2px var(--shade);
}
.mcard:hover { border-color: var(--line-strong); border-top-color: var(--fam, var(--mem)); }
.mcard.on { box-shadow: 0 0 0 2px var(--fam, var(--mem)); }
.mcard .top-line { display: flex; align-items: center; gap: 8px; }
.mcard b { font-size: 16px; }
.mfacts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 10px; font-size: 14px; }
.mfacts b { color: var(--text); font-weight: 600; }
.mpanels { margin: 12px 0 10px; }
.mpanel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--R); padding: 14px 16px; box-shadow: 0 1px 2px var(--shade); }
.mshow { margin-bottom: 8px; }
.mleft { margin-top: 10px; }
.headbar .seen { margin-left: auto; }
.seen select { width: auto; max-width: 460px; font-size: 14px; padding: 6px 9px; }
.group h2 small { font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 8px; letter-spacing: 0; }
/* the families of memory types, said once where memory is looked at */
.families { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 0 0 14px; }
.family { padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--fam); font-size: 13px; color: var(--muted); }
.family b { display: block; color: var(--fam); font-size: 14px; }
.family .types { margin-top: 6px; }

/* the login page */
.solve { display: flex; gap: 10px; align-items: flex-end; }

@media (max-width: 1180px) {
  .cols.two, .cols.main-aside, .work.yaml { grid-template-columns: minmax(0, 1fr); }
  /* one column: the page is as long as what is on it, and scrolls */
  [data-phx-main]:has(> main.studio.at-yaml), [data-phx-main]:has(> main.studio.lib), [data-phx-main]:has(> main.run) { display: block; height: auto; }
  [data-phx-main] > main.studio.at-yaml, [data-phx-main] > main.studio.lib { display: block; }
  .split { display: none; }
  .work.yaml { gap: 16px; } .work.yaml .pane.editor { min-height: 70vh; } .work.yaml .views > .view.fill { min-height: 60vh; }
  .aside { position: static; max-height: none; }
  .run { grid-template-columns: 1fr; gap: 1px; } .run .pane { overflow: visible; }
  .run .diagram > .zoom:not([data-max]) { flex: none; height: min(68vh, 560px); } .run .diagram > .parts { max-height: none; overflow: visible; }
  .views > .view.machine > .zoom:not([data-max]) { flex: none; height: 60vh; }
  .steps { gap: 12px; padding-left: 16px; padding-right: 16px; } .phase + .phase { padding-left: 12px; }
  .stage { min-width: 0; gap: 8px; padding: 0 10px 0 8px; }
  .path { grid-template-columns: repeat(2, 1fr); }
  .top nav a { padding: 0 10px; }
}

/* a narrow window: the header keeps its three places, its action and the theme in one row */
@media (max-width: 900px) {
  .top { gap: 8px; padding: 0 10px 0 12px; } .top nav { margin-left: 0; gap: 2px; } .top nav a { padding: 0 8px; gap: 6px; }
  .brand small { display: none; } .needs { padding: 0 10px; } .top .btn { padding: 0 10px; }
}

/* the login and account pages (Meta.View.Auth) */
.lock { display: grid; gap: 8px; max-width: 380px; margin: 4px 0 12px; }
.lock h2 { margin: 8px 0 4px; }
.lock label { font-size: 13px; color: var(--muted); }
.lock .btn { justify-self: start; margin-top: 6px; }
#logout { display: flex; gap: 10px; margin-top: 16px; }
.top .who { gap: 6px; }
