:root {
  --ink: #16181d;
  --muted: #5c6370;
  --line: #d8dbe2;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --accent: #2f5d8a;
  --bad: #9b2226;
  --good: #1f6f43;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; text-decoration: none; color: var(--ink); }
.bar nav { display: flex; gap: 1rem; }
.bar nav a { color: var(--muted); text-decoration: none; }
.bar nav a:hover { color: var(--accent); }
.logout { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.logout .operator { color: var(--muted); font-size: 0.85rem; }

main { max-width: 68rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

h1 { font-size: 1.35rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.muted { color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.narrow { max-width: 26rem; }

.alert {
  background: #fdf1f1;
  border: 1px solid #e4b8b8;
  border-left: 4px solid var(--bad);
  color: var(--bad);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
}

label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  background: #fff;
}

textarea { min-height: 14rem; font-family: var(--mono); font-size: 13px; }

/* The capability picker is a grid rather than a list: the registry is short
   enough to read at a glance, and a glance is what deciding what a prompt may
   emit actually takes. */
.checkgrid-field {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.25rem 0.9rem 0.9rem;
  margin: 1rem 0 0;
}
.checkgrid-field legend { font-weight: 600; padding: 0 0.35rem; }
.checkgrid-field p { margin: 0.35rem 0 0.8rem; }

.checkgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.5rem 1.25rem;
}
.checkgrid label.check {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0;
  font-weight: 400;
  cursor: pointer;
}
.checkgrid input[type=checkbox] { flex: 0 0 auto; margin: 0; }
.checkgrid .cap-note { display: block; color: var(--muted); font-size: 0.82rem; }

button {
  margin-top: 0.9rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }

.google-button {
  display: inline-block;
  margin-top: 0.9rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.google-button:hover { filter: brightness(1.08); }
.logout button { margin: 0; background: none; color: var(--muted); border-color: var(--line); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tbody tr:hover { background: #fafbfc; }

/* A key reference under a field is help text rather than the page's own data,
   so it stays quieter and tighter than a full table. */
table.keys { margin: 0 0 0.9rem; font-size: 0.85rem; }
table.keys th, table.keys td { padding: 0.3rem 0.9rem 0.3rem 0; vertical-align: top; }
table.keys td:last-child { color: var(--muted); }
table.keys tbody tr:hover { background: none; }

.tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag-completed { color: var(--good); border-color: #b7d8c5; background: #f1f8f4; }
.tag-failed { color: var(--bad); border-color: #e4b8b8; background: #fdf1f1; }

/* The trace is a debugging surface: readable beats decorative, so raw model
   input and output stay monospace and keep their original line breaks. */
details.step { border: 1px solid var(--line); border-radius: 4px; margin-bottom: 0.5rem; background: var(--panel); }
details.step > summary { cursor: pointer; padding: 0.6rem 0.8rem; font-family: var(--mono); font-size: 13px; }
details.step > div { padding: 0 0.8rem 0.8rem; }

pre {
  background: #12141a;
  color: #e6e8ee;
  border-radius: 4px;
  padding: 0.75rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }

.filters { display: flex; align-items: flex-end; gap: 0.75rem; margin-bottom: 1rem; }
.filters label { margin: 0; }
.filters select { width: auto; }
.filters button { margin: 0; }
.pager { display: flex; gap: 1rem; }
.pager a { color: var(--accent); }
.intent { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 0.6rem; }
.intent:first-child { border-top: none; margin-top: 0; padding-top: 0; }
button.override { background: var(--bad); border-color: var(--bad); }
code { font-family: var(--mono); font-size: 12.5px; }
td form { display: inline-block; margin-right: 0.4rem; }
td form button { margin-top: 0; padding: 0.25rem 0.6rem; font-size: 0.85rem; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.button-link {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.button-link:hover { filter: brightness(1.08); }

/* The prompt diff keeps its own line breaks and leading space: a prompt's
   indentation is part of what the model reads, so it has to survive display. */
.diff {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
}
.diff > div { display: flex; }
.diff .ln {
  flex: 0 0 3rem;
  padding: 0 0.5rem;
  text-align: right;
  color: var(--muted);
  user-select: none;
}
.diff .mk { flex: 0 0 1.25rem; text-align: center; user-select: none; }
.diff .dt { flex: 1 1 auto; padding-right: 0.6rem; white-space: pre-wrap; word-break: break-word; }
.d-add { background: #f1f8f4; color: var(--good); }
.d-remove { background: #fdf1f1; color: var(--bad); }
