:root {
  color-scheme: dark;
  --bg: #0b1220;
  --nav: #0e192a;
  --panel: #121d2f;
  --panel-2: #17253a;
  --field: #0b1423;
  --line: #26364d;
  --muted: #94a3b8;
  --text: #e5edf7;
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --warn: #fbbf24;
  --bad: #fb7185;
  --blue: #60a5fa;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--panel-2);
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { background: #20324a; text-decoration: none; }
.button.primary, button.primary { border-color: transparent; background: #0f766e; color: #ecfeff; }
.button.primary:hover, button.primary:hover { background: #14b8a6; color: #042f2e; }
.button.secondary { color: var(--text); }
button.danger { color: var(--bad); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 25, 42, .96);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1480px;
  min-height: 58px;
  margin: 0 auto;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; color: #fff; font-weight: 700; white-space: nowrap; }
.brand-mark { font-size: 20px; }
.nav-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav-links a { color: #cbd5e1; }
.nav-links a.active, .nav-links a:hover { color: #fff; }
.user-menu { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }
.user-menu form { margin: 0; }
.user-menu button { border: 0; padding: 4px 0; background: transparent; color: var(--muted); }

main { max-width: 1480px; margin: 0 auto; padding: 26px 24px 48px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
h1, h2, h3 { color: #f8fafc; }
h1 { margin: 0 0 6px; font-size: 25px; letter-spacing: -.02em; }
h2 { margin: 28px 0 12px; font-size: 18px; }
h3 { margin: 0 0 8px; font-size: 15px; }
p { margin: 8px 0; }
.muted, .label { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card, .box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card-link { display: block; color: inherit; }
.card-link:hover { border-color: #3b536f; text-decoration: none; }
.metric { margin: 4px 0; color: var(--accent); font-size: 28px; font-weight: 700; }
.metric-label { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stack { display: grid; gap: 12px; }
.notice { margin: 14px 0; border-left: 3px solid var(--accent); padding: 10px 13px; background: #10283a; color: #dbeafe; }
.notice.warn { border-color: var(--warn); background: #2c2411; }
.notice.error { border-color: var(--bad); background: #311822; }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; }

table { width: 100%; border-collapse: collapse; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--panel-2); color: #b9c7da; font-size: 12px; font-weight: 600; letter-spacing: .02em; position: sticky; top: 58px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #16253a; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #20324a; color: #cbd5e1; font-size: 12px; }
.pill.ok { color: var(--accent); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.access-list { display: flex; flex-wrap: wrap; gap: 5px; }
.summary-card { margin-bottom: 8px; }
.summary-card .access-list { margin-top: 8px; }

label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--field);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #64748b; }
.field { margin-bottom: 13px; }
.checkbox-list { display: grid; gap: 7px; margin: 8px 0 14px; }
.checkbox { display: flex; align-items: flex-start; gap: 8px; color: var(--text); }
.checkbox input { width: auto; margin-top: 3px; }
form.inline { display: inline; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 384px); }
.login-card .brand { margin-bottom: 24px; }
.login-card h1 { margin-bottom: 20px; }
.login-card button { width: 100%; }
.error-text { color: var(--bad); }
.success-text { color: var(--accent); }

.trace-step { border-left: 3px solid var(--line); padding: 10px 13px; }
.trace-step + .trace-step { margin-top: 8px; }
.trace-step.guard { border-color: var(--warn); }
.trace-step.retrieve, .trace-step.llm_call { border-color: var(--blue); }
.trace-step.error { border-color: var(--bad); }
code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
pre { white-space: pre-wrap; word-break: break-word; }

@media (max-width: 820px) {
  .topbar-inner { padding: 10px 16px; flex-wrap: wrap; gap: 10px 16px; }
  .brand { margin-right: 0; }
  .nav-links { order: 3; width: 100%; gap: 10px 14px; }
  .user-menu { margin-left: auto; }
  main { padding: 20px 16px 36px; }
  .page-heading, .grid-2 { grid-template-columns: 1fr; display: grid; }
  .grid-3 { grid-template-columns: 1fr; }
  .page-heading .actions { justify-content: flex-start; }
  th { position: static; }
}
