:root {
  --fg: #1c1a21; --muted: #6b6573; --line: #e7e2ee; --bg: #f7f5fa; --card: #fff;
  --accent: #6b2fb3; --accent-2: #4b1f7a; --ok: #1f8a4c; --warn: #b26a00; --bad: #b42318; --info: #0b6aa2;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); }
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 13px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #efe7fa; color: var(--accent-2); }
nav { display: flex; gap: 14px; align-items: center; }
nav a { text-decoration: none; font-weight: 600; }
main { padding: 26px 20px 40px; min-height: 60vh; }
h1 { font-size: 30px; margin: 6px 0 8px; } h2 { font-size: 20px; margin: 22px 0 10px; } h3 { font-size: 16px; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 2fr 1fr; } .cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
.hero { padding: 18px 0 6px; }
.hero p { font-size: 17px; max-width: 760px; }
.flow { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.flow span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 13px; }
.flow span.human { background: #fff4e0; border-color: #f2d49b; }
.stat { font-size: 26px; font-weight: 700; }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer; background: var(--accent); color: #fff; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: #efe7fa; color: var(--accent-2); }
button.danger { background: #fde6e4; color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select { font: inherit; width: 100%; padding: 9px 10px; border: 1px solid #d3cbe0; border-radius: 8px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
label { font-weight: 600; display: grid; gap: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.flash { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 9; padding: 10px 16px; border-radius: 8px; background: var(--fg); color: #fff; max-width: 90vw; }
.flash.error { background: var(--bad); }
.hidden { display: none; }
.stepper { display: flex; gap: 4px; margin: 10px 0 18px; overflow-x: auto; }
.step { flex: 1; min-width: 110px; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.step.done { color: var(--ok); border-color: #bfe5cd; background: #f1faf4; }
.step.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.chat { display: grid; gap: 10px; max-height: 520px; overflow-y: auto; padding: 4px; }
.msg { padding: 10px 14px; border-radius: 12px; max-width: 85%; overflow-wrap: anywhere; }
.msg.user { white-space: pre-wrap; }
.msg.agent > :first-child { margin-top: 0; } .msg.agent > :last-child { margin-bottom: 0; }
.msg.agent p, .msg.agent ul, .msg.agent ol { margin: 0 0 8px; } .msg.agent ul, .msg.agent ol { padding-left: 20px; }
.msg.pending { color: var(--muted); }
.msg.user { background: var(--accent); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.agent { background: #f1edf6; border-bottom-left-radius: 4px; }
.msg.reviewer { background: #fff4e0; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eee; }
.badge.ok { background: #e3f5ea; color: var(--ok); } .badge.bad { background: #fde6e4; color: var(--bad); }
.badge.warn { background: #fff1d6; color: var(--warn); } .badge.info { background: #e2f1fb; color: var(--info); }
.badge.synthetic { background: #fff1d6; color: var(--warn); }
.md { overflow-wrap: anywhere; } .md table { border-collapse: collapse; } .md td, .md th { border: 1px solid var(--line); padding: 4px 8px; }
.md pre { background: #f4f1f8; padding: 10px; border-radius: 8px; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs a { padding: 6px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; background: #fff; border: 1px solid var(--line); }
.tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #cdbfe0; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { background: #fff4e0; border: 1px solid #f2d49b; border-radius: var(--radius); padding: 12px 16px; }
.footer { display: flex; gap: 16px; flex-wrap: wrap; padding: 18px 20px 30px; color: var(--muted); font-size: 13px; }
code { background: #f1edf6; padding: 1px 5px; border-radius: 4px; }
label.plain { font-weight: 400; display: inline; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.wrap-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
details > summary { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
button.small { padding: 4px 10px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  nav { gap: 10px; flex-wrap: wrap; }
  nav .email { display: none; }
  h1 { font-size: 24px; }
  .msg { max-width: 95%; }
}

.msg.set-aside { opacity: .55; }
.msg.user.set-aside { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.35); }

pre { max-width: 100%; overflow-x: auto; }
