:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14181f; --muted: #5a6473; --line: #dde1e8;
  --brand: #2457d6; --brand-ink: #ffffff;
  --ok: #16794a; --ok-bg: #e6f5ec; --warn: #8a5a00; --warn-bg: #fff3d6; --bad: #b3261e; --bad-bg: #fde8e6;
  --customer: #0b6b8a; --agent: #8a5a00; --control: #16794a; --human: #7a3ea0; --system: #4a5565;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --panel: #171b22; --ink: #e8ebf0; --muted: #9aa5b5; --line: #2a303a;
    --brand: #6f97ff; --brand-ink: #0e1116;
    --ok: #4cc38a; --ok-bg: #12291f; --warn: #f0b955; --warn-bg: #2b2311; --bad: #ff8a80; --bad-bg: #2f1715;
    --customer: #5ec3e0; --agent: #f0b955; --control: #4cc38a; --human: #c79bff; --system: #9aa5b5;
  }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.top { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); position: relative; }
.logo::after { content: ""; position: absolute; left: 9px; top: 8px; width: 10px; height: 16px; border: solid var(--brand-ink); border-width: 0 3px 3px 0; transform: rotate(40deg); }
.brand strong { display: block; font-size: 16px; }
.sub { color: var(--muted); font-size: 13px; }
.who { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.who select, .who input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--bg); }
.pill.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.pill.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }

.banner { padding: 8px 20px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); font-size: 13px; }
.tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { font: inherit; padding: 12px 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

h2 { margin: 0 0 6px; font-size: 20px; }
h3 { margin: 0 0 6px; font-size: 16px; }
p { margin: 0 0 10px; }
.lede { color: var(--muted); max-width: 78ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.tile .n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

button.btn, .btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
select, textarea, input[type=text], input[type=password] { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
textarea { min-height: 96px; resize: vertical; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tablewrap { overflow-x: auto; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.mono { word-break: break-all; }

.act { border-left: 4px solid var(--brand); }
.act .claim { color: var(--muted); font-style: italic; }
.beat { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 3px 0; }
.beat .who-tag { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding-top: 2px; }
.beat.customer .who-tag { color: var(--customer); } .beat.agent .who-tag { color: var(--agent); }
.beat.control .who-tag { color: var(--control); } .beat.human .who-tag { color: var(--human); } .beat.system .who-tag { color: var(--system); }
.check { display: grid; grid-template-columns: 78px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.check:first-of-type { margin-top: 12px; }
.check .ev { color: var(--muted); font-size: 13px; }
details > summary { cursor: pointer; color: var(--brand); margin-top: 10px; }
.scroll { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
pre.view { margin: 0; padding: 12px; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; background: var(--bg); border-radius: 8px; max-height: 420px; overflow: auto; }
.msg { border-left: 3px solid var(--line); padding: 4px 10px; margin: 6px 0; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.msg b { text-transform: uppercase; font-size: 11px; letter-spacing: .05em; color: var(--muted); display: block; }
.empty { color: var(--muted); padding: 14px; text-align: center; }
.foot { max-width: 1180px; margin: 0 auto; padding: 0 16px 30px; color: var(--muted); font-size: 12.5px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@media (max-width: 640px) { .beat, .check { grid-template-columns: 1fr; gap: 2px; } .top { padding: 12px 16px; } }

.tile .n.ok { color: var(--ok); } .tile .n.warn { color: var(--warn); } .tile .n.bad { color: var(--bad); }
.clickable { cursor: pointer; }
