/* css/app.css: the agent workspace (/app, and embedded in the home page's window frame).
   Everything is scoped under .oa-root / .oa-*. The layout follows the root's own width (container queries),
   so the same app works full screen, in a 1000 x 640 frame, and on a phone (the sidebar becomes a top drawer). */

/* ---------------------------------------------------------------- /app page host */
.app-page { height: 100vh; height: 100dvh; overflow: hidden; }
.app-page #app {
  position: fixed; z-index: 1; top: calc(var(--head-h) + 8px); left: 12px; right: 12px; bottom: 12px; height: auto;
  border-radius: 18px; border: 1px solid var(--line-2); overflow: hidden;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .05) inset;
}
@media (max-width: 760px) {
  .app-page #app { top: 78px; left: 0; right: 0; bottom: 0; border-radius: 18px 18px 0 0; border-width: 1px 0 0; }
}

/* ---------------------------------------------------------------- frame */
.oa-root { container: oa / inline-size; position: relative; height: 100%; min-height: 0; }
.oa {
  --oa-frame: #12151a;
  --oa-pane: #0c0e12;
  --oa-card: #15181e;
  --oa-card-2: #1a1e25;
  --oa-gilt: #d6bd85;
  position: relative; height: 100%; min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  background: var(--oa-frame); color: var(--ink); font: 400 14px/1.5 var(--text); text-align: left;
}
.oa *, .oa *::before, .oa *::after { box-sizing: border-box; }
.oa button { text-align: inherit; }
.oa-bar, .oa-scrim, .oa-x { display: none; }
.oa-ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oa .num { font-variant-numeric: tabular-nums; }
.oa .tag { font-size: 11px; }
.oa ::-webkit-scrollbar { width: 10px; height: 10px; }
.oa ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.oa ::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .16); }
.oa ::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- sidebar */
.oa-side { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px 10px 10px; overflow: hidden; }
.oa-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.oa-back, .oa-backlink {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 6px;
  font: 500 12.5px/1 var(--text); color: var(--ink-3); transition: color .18s, background .18s;
}
.oa-back:hover, .oa-back[aria-current], .oa-backlink:hover { color: var(--ink); }
.oa-backlink { padding-left: 2px; }
.oa-side-title { display: flex; align-items: center; gap: 9px; min-width: 0; margin: 10px 8px 14px; font: 600 19px/1.2 var(--display); letter-spacing: -.015em; color: #fff; }

.oa-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink-3); box-shadow: 0 0 0 3px rgba(255, 255, 255, .05); transition: background .3s, box-shadow .3s; }
.oa-dot[data-state=on] { background: var(--ok); box-shadow: 0 0 0 3px rgba(134, 211, 164, .14); }
.oa-dot[data-state=off] { background: var(--gilt); box-shadow: 0 0 0 3px rgba(200, 171, 108, .16); }
.oa-dot[data-state=bad] { background: var(--bad); box-shadow: 0 0 0 3px rgba(240, 144, 127, .14); }
.oa-dot[data-state=busy] { background: var(--accent); animation: oa-pulse 1.1s var(--ease-io) infinite; }
.oa-dot[data-state=wait] { animation: oa-pulse 1.4s var(--ease-io) infinite; }
@keyframes oa-pulse { 50% { box-shadow: 0 0 0 5px rgba(157, 189, 234, .0); opacity: .45; } }

.oa-nav { display: flex; flex-direction: column; gap: 1px; }
.oa-acts { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.oa-item {
  display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 10px; border-radius: 7px; width: 100%;
  font: 500 13.5px/1 var(--text); color: var(--ink-2); transition: background .18s, color .18s;
}
.oa-item .ic { color: var(--ink-3); transition: color .18s; }
.oa-item:hover { background: var(--fill); color: var(--ink); }
.oa-item[aria-current] { background: rgba(189, 210, 236, .09); color: #fff; }
.oa-item[aria-current] .ic { color: var(--glaze); }

.oa-sec { display: flex; align-items: center; justify-content: space-between; margin: 16px 6px 4px 8px; font: 500 12.5px/1 var(--text); color: var(--ink-3); }
.oa-sec-i { display: inline-flex; gap: 2px; }
.oa-sec-i button { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); transition: color .18s, background .18s; }
.oa-sec-i button:hover { color: var(--ink); background: var(--fill-2); }

.oa-tree { flex: 1; min-height: 0; overflow: auto; margin: 0 -4px; padding: 0 4px 8px; scrollbar-width: thin; }
.oa-grp { margin-top: 6px; }
.oa-agent {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 28px; padding: 0 10px 0 9px; border-radius: 7px;
  font: 500 13.5px/1 var(--text); color: var(--ink-2); transition: background .18s, color .18s;
}
.oa-agent .ic { color: var(--ink-3); }
.oa-agent:hover { background: var(--fill); color: var(--ink); }
.oa-agent[aria-current] { background: var(--fill-2); color: #fff; }
.oa-adot { width: 7px; height: 7px; border-radius: 1.5px; transform: rotate(45deg); background: var(--c, var(--accent)); flex: none; margin-left: auto; }
.oa-kids { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 0 15px; padding-left: 7px; border-left: 1px solid var(--line); }
.oa-kid {
  display: flex; align-items: center; gap: 7px; width: 100%; min-width: 0; height: 25px; padding: 0 6px; border-radius: 6px;
  font: 400 12.5px/1 var(--text); color: var(--ink-3); transition: background .18s, color .18s;
}
.oa-kid .ic { flex: none; opacity: .7; }
.oa-kid:hover { background: var(--fill); color: var(--ink); }
.oa-kid.is-none { cursor: default; font-style: normal; }
.oa-kid.is-none:hover { background: none; color: var(--ink-3); }
.oa-tchip {
  display: inline-flex; align-items: center; gap: 3px; height: 17px; padding: 0 5px; margin-left: auto; flex: none;
  border-radius: 5px; border: 1px solid var(--line-2); font: 500 10.5px/1 var(--text); color: var(--ink-2);
}
.oa-tchip .ic { opacity: .8; }

/* the tier card */
.oa-acc { position: relative; flex: none; margin-top: 8px; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, .24); border: 1px solid var(--line); }
.oa-acc::before { content: ''; position: absolute; top: -1px; left: 18%; right: 18%; height: 1px; background: linear-gradient(90deg, transparent, rgba(200, 171, 108, .7), transparent); }
.oa-acc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.oa-tier { display: inline-flex; align-items: center; gap: 7px; font: 600 13px/1 var(--text); color: #fff; }
.oa-tier i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.is-holder .oa-tier i { background: var(--gilt); box-shadow: 0 0 0 3px rgba(200, 171, 108, .18); }
.oa-lim { font-size: 12px; color: var(--ink-3); }
.oa-acc-note { margin: 6px 0 10px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.oa-acc-b {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; height: 32px; border-radius: 8px;
  background: #f4f5f6; color: #12161d; font: 500 13px/1 var(--text); transition: background .18s, transform .2s var(--ease);
}
.oa-acc-b:hover { background: #e7edf6; }
.oa-acc-b:active { transform: scale(.98); }
.oa-acc-b.is-ghost { background: var(--fill-2); color: var(--ink); }
.oa-acc-b.is-ghost:hover { background: rgba(255, 255, 255, .12); }

/* ---------------------------------------------------------------- main pane */
.oa-pane { grid-column: 2; grid-row: 1; position: relative; min-width: 0; min-height: 0; margin: 8px 8px 8px 0; border-radius: 14px; background: var(--oa-pane); border: 1px solid var(--line); overflow: hidden; }
.oa-pane::before { content: ''; position: absolute; z-index: 2; top: 0; left: 14%; right: 14%; height: 1px; background: linear-gradient(90deg, transparent, rgba(200, 171, 108, .5), transparent); pointer-events: none; }
.oa-scroll { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; container: oamain / inline-size; scrollbar-width: thin; }
.oa-view { min-height: 100%; padding: 14px 20px 44px; }
.oa-enter { animation: oa-in .38s var(--ease) both; }
@keyframes oa-in { from { opacity: 0; transform: translateY(6px); } }
.oa-body { max-width: 820px; margin: 26px auto 0; }
.oa-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-height: 36px; margin-bottom: 18px; }
.oa-h { display: flex; align-items: center; gap: 10px; min-width: 0; font: 600 26px/1.15 var(--display); letter-spacing: -.02em; color: #fff; }
.oa-h-b { font: inherit; color: inherit; letter-spacing: inherit; border-radius: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oa-h-b:hover { color: var(--glaze); }
.oa-rename { height: 38px; max-width: 320px; font: 600 20px/1 var(--display); letter-spacing: -.01em; border-radius: 9px; }
.oa-state { font-size: 12.5px; color: var(--ink-3); }
.oa-state[data-state=on] { color: var(--ink-2); }
.oa-state[data-state=bad] { color: var(--bad); }
.oa-head-i { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.oa-icon-b { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); transition: color .18s, background .18s; }
.oa-icon-b:hover:not(:disabled) { color: var(--ink); background: var(--fill-2); }
.oa-icon-b:disabled { opacity: .35; cursor: not-allowed; }
.oa-confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); animation: oa-in .25s var(--ease); }
.oa-confirm button { height: 28px; padding: 0 10px; border-radius: 7px; background: var(--fill-2); color: var(--ink); font: 500 12.5px/1 var(--text); }
.oa-confirm button:hover { background: rgba(255, 255, 255, .12); }
.oa-confirm .oa-c-yes { background: rgba(240, 144, 127, .16); color: #ffb9ab; }
.oa-confirm .oa-c-yes:hover { background: rgba(240, 144, 127, .26); }
.oa-link { color: var(--accent); font: inherit; text-decoration: underline; text-decoration-color: rgba(157, 189, 234, .35); text-underline-offset: 3px; transition: color .18s, text-decoration-color .18s; }
.oa-link:hover { color: #c9dbf4; text-decoration-color: currentColor; }
.oa-head-i .oa-link { font-size: 12.5px; padding: 4px 6px; }

.oa-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.oa-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.oa-card { background: var(--oa-card); border: 1px solid var(--line); border-radius: 12px; }
.oa-card-p { padding: 14px 16px 16px; }
.oa-card-h { margin-bottom: 12px; font: 600 13.5px/1 var(--text); color: var(--ink); }
.oa-right { display: flex; justify-content: flex-end; }
.oa .oa-sbtn { border-radius: 8px; gap: 7px; }

/* engine card */
.oa-engine { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 13px 13px 16px; }
.oa-engine-t { min-width: 0; }
.oa-engine b { display: block; font: 600 15px/1.25 var(--text); color: var(--ink); }
.oa-engine[data-state=on] b { color: var(--ok); }
.oa-engine[data-state=off] b { color: var(--oa-gilt); }
.oa-engine[data-state=bad] b { color: var(--bad); }
.oa-engine small { display: block; margin-top: 3px; font-size: 12px; line-height: 1.4; color: var(--ink-3); }
.oa-run-b {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 14px; flex: none;
  border-radius: 8px; background: linear-gradient(180deg, #f8f9fb, #dde5f1); color: #12161d; font: 600 13px/1 var(--text);
  box-shadow: 0 1px 0 #fff inset, 0 8px 20px -10px rgba(122, 162, 220, .7);
  transition: transform .2s var(--ease), filter .2s, opacity .2s;
}
.oa-run-b:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
.oa-run-b:active:not(:disabled) { transform: translateY(0) scale(.98); }
.oa-run-b:disabled { opacity: .4; cursor: not-allowed; }
.oa-run-b.is-stop { background: var(--fill-2); color: var(--ink); box-shadow: none; }

/* meters */
.oa-meter { padding: 12px 16px 10px; }
.oa-meter-h { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.oa-meter-l { display: inline-flex; align-items: center; gap: 9px; align-self: center; font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.oa-meter-l .ic { color: var(--ink-3); }
.oa-meter-s { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-3); }
.oa-big { font: 500 26px/1 var(--display); letter-spacing: -.01em; color: #fff; font-variant-numeric: tabular-nums; }
.oa-unit { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.oa-spark { display: block; width: 100%; height: 40px; margin-top: 8px; color: var(--aegean); overflow: visible; }
.oa-axis { display: flex; justify-content: space-between; margin-top: 3px; font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.oa-track { height: 4px; margin-top: 16px; border-radius: 4px; background: var(--fill-2); overflow: hidden; }
.oa-track i { display: block; width: 0; min-width: 4px; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--glaze), var(--aegean)); transition: width .9s var(--ease); }
.oa-track[data-full] i { background: linear-gradient(90deg, var(--gilt), var(--bad)); }
.oa-meter-f { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); }

/* export */
.oa-lab { display: block; margin-bottom: 6px; font-size: 12px; color: var(--ink-3); }
.oa .oa-select { height: 34px; font-size: 13px; border-radius: 8px; }
.oa-dl { margin-top: 10px; }
.oa-note { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.oa-more { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; font: 500 12.5px/1.2 var(--text); color: var(--ink-2); transition: color .18s; }
.oa-more:hover { color: #fff; }
.oa-more .ic { transition: transform .25s var(--ease); }
.oa-more[aria-expanded=true] .ic { transform: rotate(90deg); }

/* MCP */
.oa-mcp { padding: 14px 16px 16px; }
.oa-swrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.oa-sw { position: relative; flex: none; width: 30px; height: 18px; border-radius: 999px; background: rgba(255, 255, 255, .14); transition: background .25s var(--ease); }
.oa-sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform .3s var(--ease); }
.oa-sw[aria-checked=true] { background: #4f83de; }
.oa-sw[aria-checked=true]::after { transform: translateX(12px); }
.oa-sw:disabled { opacity: .35; cursor: not-allowed; }
.oa-facts { margin-top: 2px; }
.oa-fact { display: grid; grid-template-columns: 74px minmax(0, 1fr) 22px; align-items: center; gap: 8px; min-height: 34px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.oa-fact > span:first-child { color: var(--ink-3); }
.oa-fact-v { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.oa-fact-v .mono { font-size: 12px; }
.oa-use { margin-top: 16px; }
.oa-use h5 { margin: 0 0 6px; font: 600 13.5px/1.25 var(--text); color: #fff; }
.oa-use p { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.oa-use b, .oa-more-b b { font-weight: 600; color: var(--ink); }
.oa .oa-snip { margin: 10px 0 0; padding: 10px 34px 10px 12px; font-size: 11.5px; line-height: 1.55; max-height: 180px; overflow: auto; }
.oa .oa-snip .copy-btn { top: 6px; right: 6px; }
.oa-copy {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; margin-top: 10px; padding: 0 13px; border-radius: 8px;
  background: #f4f5f6; color: #12161d; font: 500 13px/1 var(--text); transition: background .18s, transform .2s var(--ease);
}
.oa-copy:hover { background: #e7edf6; }
.oa-copy:active { transform: scale(.98); }
.oa-ml { margin-top: 12px; font-size: 12px !important; color: var(--ink-3) !important; }
.oa-more-b { animation: oa-in .3s var(--ease); }
.oa-more-b[hidden] { display: none; }

/* ---------------------------------------------------------------- console */
.oa-console {
  padding: 12px 12px 10px; border-radius: 12px; background: var(--oa-card); border: 1px solid var(--line-2);
  transition: border-color .2s, box-shadow .2s;
}
.oa-console:focus-within { border-color: rgba(122, 162, 220, .55); box-shadow: 0 0 0 4px rgba(122, 162, 220, .08); }
.oa-ta { display: block; width: 100%; min-height: 66px; max-height: 260px; padding: 2px 4px; resize: vertical; border: 0; outline: none; background: none; color: var(--ink); font: 400 14.5px/1.55 var(--text); }
.oa-ta::placeholder { color: var(--ink-3); }
.oa-console-f { display: flex; align-items: flex-end; gap: 10px; margin-top: 8px; }
.oa-presets { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.oa-pchip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 7px; max-width: 100%;
  border: 1px solid var(--line-2); font: 400 12px/1 var(--text); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .18s, border-color .18s, background .18s;
}
button.oa-pchip:hover { color: #fff; border-color: rgba(189, 210, 236, .4); background: rgba(189, 210, 236, .06); }
.oa-kbd { display: inline-flex; gap: 3px; padding-bottom: 6px; flex: none; }
.oa-kbd kbd { padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line-2); font: 500 10.5px/1.2 var(--text); color: var(--ink-3); }

.oa-out { margin-top: 16px; }
.oa-empty { padding: 15px 18px; border-radius: 12px; border: 1px dashed var(--line-2); font-size: 13px; line-height: 1.55; color: var(--ink-3); }
.oa-empty.is-warn { margin-top: 10px; border-style: solid; border-color: rgba(200, 171, 108, .3); color: var(--ink-2); background: rgba(200, 171, 108, .04); }
.oa-empty.is-slim { margin-bottom: 12px; padding: 10px 14px; font-size: 12.5px; }

.oa-running { position: relative; overflow: hidden; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--oa-card); font-size: 13px; color: var(--ink-2); }
.oa-running::after { content: ''; position: absolute; left: 0; bottom: 0; width: 40%; height: 2px; background: linear-gradient(90deg, transparent, var(--aegean), transparent); animation: oa-sweep 1.4s var(--ease-io) infinite; }
@keyframes oa-sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.oa-pend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.oa-pchip.is-pend { font-family: var(--mono); font-size: 11px; animation: oa-fade 1.6s var(--ease-io) infinite; }
.oa-pchip.is-pend:nth-child(2) { animation-delay: .2s; } .oa-pchip.is-pend:nth-child(3) { animation-delay: .4s; } .oa-pchip.is-pend:nth-child(4) { animation-delay: .6s; }
@keyframes oa-fade { 50% { opacity: .45; } }
.oa-elapsed { color: var(--ink-2); }

.oa-run-h { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 2px 2px 10px; }
.oa-run-task { min-width: 0; font-size: 13.5px; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.oa-run-meta { flex: none; font-size: 12px; color: var(--ink-3); }

.oa-calls { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.oa-call details { border-radius: 10px; background: var(--oa-card); border: 1px solid var(--line); overflow: hidden; transition: border-color .2s; }
.oa-call details[open] { border-color: var(--line-2); }
.oa-call summary {
  list-style: none; cursor: pointer; display: grid; align-items: center; gap: 10px; padding: 8px 12px 8px 9px;
  grid-template-columns: 28px auto minmax(0, 1fr) auto auto 12px; font-size: 13px; transition: background .18s;
}
.oa-call summary::-webkit-details-marker { display: none; }
.oa-call summary:hover { background: var(--fill); }
.oa-call-i { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: rgba(189, 210, 236, .08); color: var(--glaze); }
.oa-call[data-ok=false] .oa-call-i { background: rgba(240, 144, 127, .1); color: var(--bad); }
.oa-call-n { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.oa-call-n b { font-weight: 500; color: var(--ink); }
.oa-call-a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 11.5px/1.3 var(--mono); color: var(--ink-3); }
.oa-call-ms { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.oa-st { padding: 3px 6px; border-radius: 5px; font: 500 11px/1 var(--text); color: var(--ok); background: rgba(134, 211, 164, .1); }
.oa-st[data-ok=false] { color: var(--bad); background: rgba(240, 144, 127, .12); }
.oa-chev { display: inline-flex; color: var(--ink-3); }
.oa-chev .ic { transition: transform .25s var(--ease); }
.oa-call details[open] .oa-chev .ic { transform: rotate(90deg); }
.oa-call-b { padding: 2px 12px 12px; border-top: 1px solid var(--line); animation: oa-in .3s var(--ease); }
.oa-call-top { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.oa-call-sum { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); }
.oa-call-err { flex: 1; min-width: 0; font-size: 12.5px; color: var(--bad); overflow-wrap: anywhere; }
.oa-seg.is-s { margin: 0; padding: 2px; border-radius: 7px; flex: none; }
.oa-seg.is-s button { height: 22px; padding: 0 9px; border-radius: 5px; font-size: 11.5px; }
.oa-rv { margin-top: 10px; }
.oa-rv-kv { border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: var(--oa-card-2); }
.oa-rv-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: -1px 0 0 -1px; }
.oa-rv-g > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 10px; box-shadow: inset 1px 0 0 var(--line), inset 0 1px 0 var(--line); }
.oa-rv-kv span { font: 400 11px/1.2 var(--mono); color: var(--ink-3); }
.oa-rv-kv b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.oa-rv-h { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 6px; font: 500 11.5px/1 var(--mono); color: var(--ink-2); }
.oa-rv-h span { color: var(--ink-3); }
.oa-rv .oa-tbl td { color: var(--ink); }
.oa-rv .oa-tbl th { font: 500 11px/1.2 var(--mono); }
.oa-rv-more { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }
.oa-rv-note { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.oa-call-args { display: flex; gap: 8px; align-items: baseline; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.oa-call-args code { min-width: 0; overflow-wrap: anywhere; color: var(--ink-2); font-size: 11.5px; }
.oa-json { position: relative; margin-top: 10px; border-radius: 9px; background: var(--abyss); border: 1px solid var(--line); }
.oa-json pre { margin: 0; padding: 10px 12px; max-height: 340px; overflow: auto; font: 400 11.5px/1.6 var(--mono); color: #c3cddb; white-space: pre; tab-size: 2; }
.oa-json .copy-btn { position: absolute; top: 6px; right: 8px; }
.j-k { color: #9dbdea; } .j-s { color: #dcc99a; } .j-n { color: #a5d8bb; } .j-l { color: #e7a993; }

.oa-answer { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: linear-gradient(180deg, rgba(189, 210, 236, .07), rgba(189, 210, 236, .02)); border: 1px solid rgba(189, 210, 236, .16); animation: oa-in .4s var(--ease) both; }
.oa-answer.is-raw { background: rgba(200, 171, 108, .05); border-color: rgba(200, 171, 108, .24); }
.oa-answer.is-raw p { font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.oa-answer-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font: 600 13.5px/1.25 var(--text); color: #fff; }
.oa-answer-h .ic { color: var(--glaze); }
.oa-answer-h .tag { margin-left: auto; }
.is-raw .oa-answer-h { color: var(--oa-gilt); }
.is-raw .oa-answer-h .ic { color: var(--oa-gilt); }
.oa-md { font-size: 14px; line-height: 1.62; color: var(--ink); }
.oa-md > * + * { margin-top: 10px; }
.oa-md h4 { font: 600 14.5px/1.3 var(--text); letter-spacing: 0; color: #fff; }
.oa-md ul, .oa-md ol { margin-bottom: 0; padding-left: 20px; }
.oa-md li + li { margin-top: 4px; }
.oa-md code { padding: 1px 5px; border-radius: 4px; background: var(--fill-2); font-size: 12.5px; }
.oa-md b { font-weight: 600; color: #fff; }
.oa-md a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.oa-pre { padding: 10px 12px; border-radius: 8px; background: var(--abyss); border: 1px solid var(--line); font: 400 12px/1.55 var(--mono); overflow: auto; white-space: pre; }
.oa-tblw { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.oa-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.oa-tbl th, .oa-tbl td { padding: 7px 10px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
.oa-tbl thead th { border-top: 0; color: var(--ink-2); font-weight: 600; background: var(--fill); }
.oa-usage { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 2px 0; font-size: 12px; color: var(--ink-3); }

.oa-err { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(240, 144, 127, .3); background: rgba(240, 144, 127, .06); animation: oa-in .35s var(--ease) both; }
.oa-err-i { flex: none; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: rgba(240, 144, 127, .14); color: var(--bad); }
.oa-err b { display: block; font: 600 13.5px/1.3 var(--text); color: #ffc4b8; }
.oa-err p { margin-top: 3px; font-size: 13px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
.oa-err-more { margin-top: 8px !important; }

/* ---------------------------------------------------------------- runs */
.oa-seg { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 12px; border-radius: 9px; background: var(--fill); border: 1px solid var(--line); max-width: 100%; }
.oa-seg button { height: 26px; padding: 0 11px; border-radius: 6px; font: 500 12.5px/1 var(--text); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .18s, color .18s; }
.oa-seg button[aria-selected=true] { background: rgba(255, 255, 255, .09); color: var(--ink); }
.oa-runs { display: flex; flex-direction: column; border-radius: 12px; background: var(--oa-card); border: 1px solid var(--line); overflow: hidden; }
.oa-row {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) 128px 64px 72px 72px; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); transition: background .18s;
}
.oa-row:first-child { border-top: 0; }
.oa-row:hover { background: var(--fill); }
.oa-row .oa-adot { margin: 0; }
.oa-row-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.oa-row-a { color: var(--ink-2); }
.oa-row-c, .oa-row-u, .oa-row-w { text-align: right; white-space: nowrap; font-size: 12px; }

/* ---------------------------------------------------------------- tools */
.oa-tgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.oa-tgroup { padding: 13px 14px 4px; }
.oa-tgroup .oa-card-h { margin-bottom: 4px; color: var(--ink-2); font-weight: 500; font-size: 12.5px; }
.oa-trow { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px 0; border-top: 1px solid var(--line); }
.oa-tgroup .oa-card-h + .oa-trow { border-top: 0; }
.oa-trow-i { padding-top: 1px; color: var(--glaze); }
.oa-trow-n { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: 13.5px; }
.oa-trow-n b { font-weight: 500; color: var(--ink); }
.oa-trow-d { margin-top: 3px; font-size: 12px; line-height: 1.45; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.oa-trow-s { margin-top: 4px; font-size: 11px; color: var(--ink-3); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oa-trow .oa-sw { margin-top: 2px; }
.oa-foot-note { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------- all agents */
.oa-agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.oa-acard { display: flex; flex-direction: column; gap: 6px; min-height: 112px; padding: 14px; transition: border-color .2s, transform .25s var(--ease), background .2s; }
.oa-acard:hover { border-color: var(--line-2); transform: translateY(-1px); background: var(--oa-card-2); }
.oa-acard.is-on { border-color: rgba(189, 210, 236, .3); }
.oa-acard-h { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 14px; color: #fff; }
.oa-acard-h b { font-weight: 600; }
.oa-acard-h .oa-adot { margin: 0; }
.oa-acard-p { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.oa-acard-s { margin-top: auto; font-size: 12px; color: var(--ink-3); }
.oa-acard.is-add { flex-direction: row; align-items: center; justify-content: center; gap: 8px; background: transparent; border-style: dashed; border-color: var(--line-2); color: var(--ink-2); font-size: 13.5px; }
.oa-acard.is-add:hover { color: #fff; }

/* ---------------------------------------------------------------- responsive (by the app's own width) */
@container oa (max-width: 1080px) and (min-width: 761px) {
  .oa { grid-template-columns: 226px minmax(0, 1fr); }
  .oa-view { padding: 12px 16px 36px; }
  .oa-body { margin-top: 18px; }
  .oa-h { font-size: 23px; }
  .oa-acc-note { font-size: 12px; margin: 4px 0 8px; }
}
@container oamain (max-width: 700px) {
  .oa-cols, .oa-tgrid { grid-template-columns: minmax(0, 1fr); }
}
@container oamain (max-width: 560px) {
  .oa-row { grid-template-columns: 8px minmax(0, 1fr) auto auto; }
  .oa-row-a, .oa-row-u { display: none; }
  .oa-call summary { grid-template-columns: 28px minmax(0, 1fr) auto auto 12px; }
  .oa-call-a { display: none; }
  .oa-kbd { display: none; }
  .oa-run-h { flex-direction: column; gap: 2px; }
}

/* phone: the sidebar becomes a drawer from the top */
@container oa (max-width: 760px) {
  .oa { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .oa-bar { display: flex; grid-row: 1; align-items: center; gap: 6px; padding: 8px 8px 6px; }
  .oa-bar-b { width: 38px; height: 38px; flex: none; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--fill-2); color: var(--ink); }
  .oa-bar-t { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px; font: 600 17px/1 var(--display); letter-spacing: -.01em; color: #fff; }
  .oa-bar-v { margin-left: auto; padding-left: 8px; font: 500 12px/1 var(--text); color: var(--ink-3); white-space: nowrap; }
  .oa-pane { grid-column: 1; grid-row: 2; margin: 0 6px 6px; }
  .oa-side {
    grid-row: auto; grid-column: auto; /* auto lines: the drawer is placed against the whole frame, not a grid cell */
    position: absolute; z-index: 6; top: 6px; left: 6px; right: 6px; max-height: calc(100% - 12px); overflow: auto;
    padding: 12px 10px 10px; border-radius: 16px; background: #15181e; border: 1px solid var(--line-2);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .85);
    transform: translateY(-16px) scale(.98); transform-origin: top center; opacity: 0; visibility: hidden;
    transition: transform .35s var(--ease), opacity .22s ease, visibility 0s linear .35s;
  }
  .oa[data-drawer=open] .oa-side { transform: none; opacity: 1; visibility: visible; transition: transform .35s var(--ease), opacity .22s ease; }
  .oa-tree { flex: none; overflow: visible; }
  .oa-scrim { display: block; position: absolute; z-index: 5; inset: 0; background: rgba(5, 6, 8, .6); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
  .oa[data-drawer=open] .oa-scrim { opacity: 1; pointer-events: auto; }
  .oa-x { display: inline-flex; width: 32px; height: 32px; border-radius: 9px; align-items: center; justify-content: center; color: var(--ink-2); background: var(--fill-2); }
  .oa-item, .oa-agent { height: 36px; }
  .oa-kid { height: 32px; }
  .oa-view { padding: 10px 14px 32px; }
  .oa-body { margin-top: 12px; }
  .oa-h { font-size: 22px; }
  .oa-big { font-size: 24px; }
  .oa-console-f { flex-wrap: wrap; }
  .oa-presets { flex-basis: 100%; }
  .oa-console-f .oa-run-b { margin-left: auto; height: 36px; }
}

.oa:not(.is-ready) .oa-side, .oa:not(.is-ready) .oa-scrim { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .oa *, .oa *::before, .oa *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* touch: every control at least about 40 px to the finger, without changing how it looks at rest */
@media (pointer: coarse), (max-width: 600px) {
  .oa-root .oa-back, .oa-root .oa-backlink, .oa-root .oa-h-b { min-height: 40px; }
  .oa-root .oa-x, .oa-root .oa-icon-b { min-width: 40px; min-height: 40px; }
  .oa-root .oa-kid, .oa-root .oa-acc-b { min-height: 40px; }
  .oa-root .oa-run-b, .oa-root .oa-copy { min-height: 40px; }
  .oa-root .oa-more { min-height: 40px; margin-top: 4px; }
  .oa-root .oa-link { padding: 8px 0; margin: -8px 0; }
  .oa-root .oa-sec-i button { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; }
  .oa-root .oa-sw::before { content: ''; position: absolute; inset: -11px -8px; }
}
