:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #14181f;
  --muted: #6a7280;
  --line: #e4e7ec;
  --accent: #2b59c3;
  --accent-soft: #e9effc;
  --ok: #157f52;
  --ok-soft: #e5f5ed;
  --warn: #b5590d;
  --warn-soft: #fdf0e4;
  --bad: #c0362c;
  --bad-soft: #fcebea;
  --radius: 10px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "JetBrains Mono", "SF Mono", Menlo, monospace; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.brand.big b { font-size: 18px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #2b59c3, #6b3fd4); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 500; }
.btn:hover { border-color: #c9ced8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #234aa6; }
.btn.wide { width: 100%; padding: 11px; }
.btn:disabled { opacity: .55; cursor: default; }

.auth-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #e6ecfb, transparent 50%), radial-gradient(circle at 90% 90%, #efe7fb, transparent 45%), var(--bg); }
.auth-card { width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: 0 20px 50px rgba(20, 24, 31, .08); }
.auth-card form { margin-top: 26px; display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 6px; font-weight: 500; font-size: 13px; }
.auth-card input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.auth-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.auth-card a { color: var(--accent); }

.top { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 4px; margin-left: 28px; }
.top nav button { border: 0; background: none; padding: 8px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.top nav button.on { background: var(--accent-soft); color: var(--accent); }
.top .left { display: flex; align-items: center; }
.badges { display: flex; gap: 8px; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: #f1f3f6; color: #3a414d; border: 1px solid var(--line); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(21, 127, 82, .15); }
.badge.bad .dot { background: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 14px 20px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.layout { display: grid; grid-template-columns: 290px 1fr 440px; gap: 14px; padding: 14px 20px 20px; height: calc(100vh - 60px - 90px); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); gap: 8px; }
.panel-head h3 { margin: 0; font-size: 13px; font-weight: 600; }
.scroll { overflow: auto; min-height: 0; flex: 1; }

.inbox-item { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.inbox-item:hover { background: #fafbfc; }
.inbox-item.on { background: var(--accent-soft); }
.inbox-item .ico { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.ico.invoice { background: #e9effc; color: #2b59c3; }
.ico.kyc { background: #f1e9fc; color: #6b3fd4; }
.ico.claim { background: #fdf0e4; color: #b5590d; }
.ico.other { background: #eef0f3; color: #6a7280; }
.inbox-item .t { flex: 1; min-width: 0; }
.inbox-item .t b { display: block; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item .t small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.queued { background: #eef0f3; color: #6a7280; }
.pill.running { background: var(--accent-soft); color: var(--accent); }
.pill.completed { background: var(--ok-soft); color: var(--ok); }
.pill.needs_review { background: var(--warn-soft); color: var(--warn); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }

.tabs { display: flex; gap: 4px; background: #f1f3f6; padding: 3px; border-radius: 8px; }
.tabs button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.doc { padding: 22px 26px; white-space: pre-wrap; font-family: "JetBrains Mono", "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.65; color: #252b35; }
.doc mark { border-radius: 4px; padding: 1px 3px; background: #ffe1df; color: #8f1d14; box-shadow: inset 0 -1.5px 0 #f3a29b; }
.doc mark[data-k]::after { content: attr(data-k); font-family: Inter, sans-serif; font-size: 9px; font-weight: 700; letter-spacing: .04em; margin-left: 5px; padding: 0 4px; border-radius: 3px; background: #c0362c; color: #fff; vertical-align: 1px; }
.doc .tok { border-radius: 4px; padding: 1px 6px; background: #14181f; color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.doc-banner { margin: 14px 18px 0; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.doc-banner.red { background: var(--bad-soft); color: #8f1d14; }
.doc-banner.dark { background: #14181f; color: #e8eaee; }

.pdf-frame { margin: 14px 18px 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 560px; background: #525659; }
.pdf-frame iframe { width: 100%; height: 100%; border: 0; }
.doc-sub { margin: 16px 26px -10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.empty { margin: auto; text-align: center; color: var(--muted); padding: 40px; }

.steps { padding: 6px 14px 4px; }
.step { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed #edf0f3; }
.step:last-child { border-bottom: 0; }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: #f1f3f6; color: var(--muted); }
.step.running .n { background: var(--accent); color: #fff; animation: pulse 1s infinite; }
.step.done .n { background: var(--ok); color: #fff; }
.step.skipped .n { background: #f1f3f6; color: #b5bbc5; }
.step b { font-weight: 550; font-size: 13px; }
.step small { display: block; color: var(--muted); font-size: 11.5px; }
.step .ms { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(43, 89, 195, .35); } 50% { box-shadow: 0 0 0 6px rgba(43, 89, 195, 0); } }

.verdict { margin: 12px 14px 4px; padding: 14px; border-radius: 10px; display: flex; gap: 12px; align-items: center; }
.verdict .big { font-size: 15px; font-weight: 650; }
.verdict.ok { background: var(--ok-soft); color: #0e5b3a; }
.verdict.review { background: var(--warn-soft); color: #87420a; }
.verdict.info { background: var(--accent-soft); color: #1d3f8f; }
.verdict .icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 700; background: rgba(255, 255, 255, .7); flex: none; }

.card { margin: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.card h4 { margin: 0; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid #f0f2f5; display: flex; justify-content: space-between; }
.card .body { padding: 10px 12px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 500; word-break: break-word; }
.kv .v.null { color: #b5bbc5; font-weight: 400; font-style: italic; }
.check { display: flex; gap: 8px; padding: 4px 0; font-size: 13px; align-items: flex-start; }
.check .m { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; margin-top: 1px; }
.check.ok .m { background: var(--ok-soft); color: var(--ok); }
.check.bad .m { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 6px; background: #14181f; color: #fff; }
.chip i { font-style: normal; opacity: .65; margin-left: 4px; }
.conf { height: 6px; border-radius: 3px; background: #eef0f3; overflow: hidden; margin-top: 6px; }
.conf > div { height: 100%; background: var(--accent); }
.typeline { display: flex; align-items: baseline; justify-content: space-between; }
.typeline .tv { font-size: 18px; font-weight: 650; text-transform: capitalize; }
.action-name { font-size: 15px; font-weight: 650; }
.match { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.match.y { background: var(--ok-soft); color: var(--ok); }
.match.n { background: var(--bad-soft); color: var(--bad); }

pre.json { margin: 0; padding: 14px; font-size: 11.5px; line-height: 1.5; background: #0f141b; color: #d6dbe3; border-radius: 0 0 10px 10px; overflow: auto; max-height: 100%; }
.dev { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; height: calc(100vh - 60px); overflow: auto; }
.dev .panel { min-height: 0; }
table.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
table.keys td, table.keys th { padding: 9px 14px; border-bottom: 1px solid #f0f2f5; text-align: left; }
table.keys th { color: var(--muted); font-weight: 500; font-size: 12px; }
.newkey { margin: 14px; padding: 12px; border-radius: 8px; background: var(--ok-soft); font-size: 12.5px; word-break: break-all; }
.caption { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(10px); max-width: 860px; padding: 12px 20px; border-radius: 12px; background: rgba(15, 20, 27, .92); color: #fff; font-size: 16px; font-weight: 500; line-height: 1.45; text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); opacity: 0; transition: opacity .35s, transform .35s; pointer-events: none; z-index: 50; }
.caption.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.caption b { color: #9cc0ff; font-weight: 600; }
.spot { outline: 3px solid #f5b400 !important; outline-offset: 2px; border-radius: 8px; transition: outline-color .3s; }
.acc { padding: 20px; height: calc(100vh - 60px); overflow: auto; }
.acc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 16px; }
.acc-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.acc-head p { margin: 0; max-width: 820px; line-height: 1.5; }
.acc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.acc-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; border-top: 3px solid var(--line); }
.acc-card.ok { border-top-color: var(--ok); }
.acc-card.bad { border-top-color: var(--bad); }
.acc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.acc-v { font-size: 28px; font-weight: 650; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.acc-v small { font-size: 12px; color: var(--muted); font-weight: 500; }
.acc-bar { position: relative; height: 8px; border-radius: 4px; background: #eef0f3; }
.acc-bar > div { height: 100%; border-radius: 4px; background: var(--accent); }
.acc-card.ok .acc-bar > div { background: var(--ok); }
.acc-card.bad .acc-bar > div { background: var(--bad); }
.acc-bar i { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); border-radius: 1px; }
.acc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.weak-wrap { padding: 10px 14px; display: grid; gap: 12px; }
.weak b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.weak-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #edf0f3; font-size: 13px; }
.acc-miss { margin-top: 12px; }
.acc-miss ul { margin: 0; padding: 6px 14px 12px; list-style: none; max-height: 360px; overflow: auto; }
.acc-miss li { padding: 6px 0; border-bottom: 1px solid #f0f2f5; font-size: 13px; display: flex; gap: 12px; }
.acc-miss li .mono { color: var(--muted); font-size: 12px; min-width: 96px; }
#miss-tabs button i { font-style: normal; opacity: .6; margin-left: 3px; }
@media (max-width: 1100px) { .acc-grid { grid-template-columns: repeat(2, 1fr); } .acc-cols { grid-template-columns: 1fr; } }
.hidden, [hidden] { display: none !important; }
#msg:empty { display: none; }
