:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #020617;
  color: #e2e8f0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  padding: 24px 28px;
  border-bottom: 1px solid #1e293b;
  background: linear-gradient(135deg, #020617, #052e2b);
}
h1 { margin: 0; font-size: 26px; letter-spacing: 0.04em; }
h1 span { color: #10b981; font-weight: 500; }
.sub { margin-top: 8px; font-size: 15px; color: #94a3b8; max-width: 640px; line-height: 1.5; }
.credit { margin-top: 10px; font-size: 13px; color: #64748b; }
.credit a { color: #6ee7b7; }
.badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.badge.ok { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.35); color: #6ee7b7; }
.badge.warn { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.3); color: #fcd34d; }

main { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 24px 28px; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }
section.agent { grid-column: 1 / -1; }

section {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #1e293b;
  border-radius: 18px;
  padding: 18px;
}
section.safe { border-color: rgba(16, 185, 129, 0.35); }
section.agent { border-color: rgba(6, 182, 212, 0.35); }

h2 { margin: 0 0 12px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.07em; color: #cbd5e1; }
h2 .tag { text-transform: none; letter-spacing: normal; font-size: 12px; font-weight: 600; color: #22d3ee; margin-left: 6px; }

textarea, pre, input[type="text"], select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: #020617;
  border: 1px solid #1e293b;
  color: #e2e8f0;
  font-size: 14.5px;
  line-height: 1.6;
}
textarea { min-height: 200px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
textarea.role { min-height: 110px; font-family: ui-sans-serif, system-ui, sans-serif; }
textarea:focus, input:focus, select:focus { outline: none; border-color: rgba(16, 185, 129, 0.6); }

pre { margin: 0; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.log { max-height: 260px; font-size: 12.5px; color: #67e8f9; }

mark { background: rgba(16, 185, 129, 0.2); color: #a7f3d0; border-bottom: 1px solid rgba(52, 211, 153, 0.6); border-radius: 2px; padding: 0 2px; font-weight: 700; }

button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #10b981;
  color: #020617;
}
button.ghost { background: rgba(255, 255, 255, 0.06); color: #e2e8f0; border: 1px solid rgba(255, 255, 255, 0.12); }
button:hover { filter: brightness(1.08); }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

ul.tokens { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
ul.tokens li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #020617; border: 1px solid #1e293b; font-size: 13.5px; }
ul.tokens li.off { opacity: 0.45; }
.tag { font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; background: rgba(148, 163, 184, 0.15); color: #cbd5e1; white-space: nowrap; }
.ph { font-family: ui-monospace, monospace; color: #34d399; font-size: 13px; white-space: nowrap; }
.val { font-family: ui-monospace, monospace; color: #e2e8f0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.opt { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #94a3b8; cursor: pointer; }
.opt input { accent-color: #10b981; }

.warn { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(245, 158, 11, 0.06); border: 1px solid rgba(245, 158, 11, 0.3); color: #fcd34d; font-size: 13.5px; line-height: 1.6; }
.warn.ok { background: rgba(16, 185, 129, 0.06); border-color: rgba(16, 185, 129, 0.3); color: #6ee7b7; }

.lab { display: block; margin: 14px 0 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; }
.note { margin: 8px 0 0; font-size: 12.5px; color: #64748b; line-height: 1.6; }
.note code, footer code { background: rgba(148, 163, 184, 0.12); padding: 1px 5px; border-radius: 5px; color: #a5b4fc; }

footer { padding: 18px 28px 36px; color: #64748b; font-size: 13px; line-height: 1.7; border-top: 1px solid #1e293b; }
footer a { color: #6ee7b7; }

.lab.inline { display: inline; margin: 0 4px 0 0; align-self: center; }

/* Incoming tool-call log */
ul.calls { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
ul.calls li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #020617; border: 1px solid #1e293b; font-size: 13px; }
ul.calls li.empty { color: #475569; font-style: italic; justify-content: center; }
.when { font-family: ui-monospace, monospace; color: #64748b; font-size: 12px; white-space: nowrap; }
.src { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.src.external { background: rgba(6, 182, 212, 0.15); color: #67e8f9; border: 1px solid rgba(6, 182, 212, 0.45); }
.src.internal { background: rgba(148, 163, 184, 0.12); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }
.src.failed { background: rgba(244, 63, 94, 0.12); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.35); }

.agent-notice { border-left: 2px solid rgba(6, 182, 212, 0.5); padding-left: 10px; color: #94a3b8; }
.agent-notice b { color: #67e8f9; }
