:root {
  --bg: #ffffff; --fg: #1a1d21; --muted: #5b6573; --line: #e4e7ec;
  --card: #f8fafc; --accent: #4653f0; --accent-hover: #3a46d4;
  --ok: #1a7f37; --bad: #b42318; --warn: #b45309;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318; --fg: #e6e9ee; --muted: #9aa4b6; --line: #2a2f3a;
    --card: #171b22; --accent: #8b95ff; --accent-hover: #a3abff;
    --ok: #4ade80; --bad: #f87171; --warn: #fbbf24;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  flex-wrap: wrap; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: .75rem; }
h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 .75rem; }
h3 { font-size: .85rem; margin: 1rem 0 .35rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); font-size: .85rem; }
.auth { display: flex; gap: .5rem; }
main { max-width: 72rem; margin: 0 auto; padding: 1.5rem; display: grid; gap: 2rem; }
section { min-width: 0; }
.banner { background: var(--card); border: 1px solid var(--bad); color: var(--bad);
  padding: .5rem .75rem; border-radius: 6px; margin: 0; }
.cards { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: .4rem .7rem; font-size: .85rem; }
.card b { font-weight: 600; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
th { background: var(--card); font-weight: 600; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
td.err { white-space: normal; min-width: 14rem; color: var(--muted); }
.chip {
  display: inline-block; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 .55em; margin: .1rem .2rem .1rem 0;
  font-size: .75rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.row { display: flex; align-items: center; gap: .75rem; margin: .5rem 0; }
.seg { gap: 0; }
.seg button {
  background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 0;
}
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button + button { border-left: none; }
.seg button.active { background: var(--accent); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) { .seg button.active { color: #101318; } }
.seg button:hover:not(:disabled):not(.active) { background: var(--line); }
input, select, textarea, button {
  font: inherit; color: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: .45rem .7rem;
}
input { width: 20rem; max-width: 100%; }
select, textarea { width: 100%; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
button { cursor: pointer; background: var(--accent); color: #fff; border-color: transparent; transition: background-color 120ms ease-out; }
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: .45; cursor: default; }
@media (prefers-color-scheme: dark) { button { color: #101318; } }
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
h1, h2 { text-wrap: balance; }
[hidden] { display: none !important; }
.pane {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: .75rem; margin: 0; overflow: auto; max-height: 18rem; min-height: 3rem;
  font: .8rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap;
}
.pane:empty::before { content: "Nothing yet — connect and call a tool."; color: var(--muted); font-family: inherit; }
.pane.tall { max-height: 26rem; }
