:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #f9fafc;
  --line: #e5e7ef;
  --line-2: #eef0f5;
  --text: #171a26;
  --text-2: #565c70;
  --text-3: #8a90a3;
  --accent: #4f46e5;
  --accent-2: #eef0ff;
  --accent-ink: #3730a3;
  --ok: #0f9d58;
  --ok-bg: #e7f6ee;
  --warn: #b45309;
  --warn-bg: #fff4e0;
  --err: #d33a2c;
  --err-bg: #fdecea;
  --info: #2563eb;
  --info-bg: #e8f0ff;
  --fb: #1877f2;
  --bx: #2fc6f6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 5px; }
.boot { padding: 40px; color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: #12142b; color: #c9cce0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; }
.brand img { width: 28px; height: 28px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: #8d91b5; }
.side-section { padding: 10px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f7398; display: flex; justify-content: space-between; align-items: center; }
.side-section button { background: none; border: 0; color: #a5a9d6; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.side-list { flex: 1; overflow: auto; padding: 0 8px; }
.side a.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c9cce0; margin-bottom: 2px; text-decoration: none; }
.side a.item:hover { background: #1c1f3d; color: #fff; }
.side a.item.active { background: #272b55; color: #fff; }
.side .avatar { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.side .dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none; }
.side-foot { border-top: 1px solid #23264a; padding: 10px 8px; }
.side-foot .who { padding: 6px 10px; font-size: 12px; color: #8d91b5; }
.main { min-width: 0; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); padding: 16px 28px 0; position: sticky; top: 0; z-index: 5; }
.topbar .title-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tabs a { padding: 9px 14px; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 550; white-space: nowrap; text-decoration: none; display: flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-color: var(--accent); }
.tabs .count { background: var(--err); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 17px; }
.tabs .count.warn { background: #f59e0b; }
.content { padding: 24px 28px 60px; max-width: 1280px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side-list { max-height: 200px; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 16px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-b { padding: 16px 18px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); }
.card.pad { padding: 18px; }
.card.hover:hover { border-color: #c7cbe0; box-shadow: 0 4px 14px rgba(16,24,40,.08); }
a.card { color: inherit; text-decoration: none; display: block; }
.stat { padding: 16px 18px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--text-2); font-size: 12.5px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: 9px; font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-2); border-color: #cfd3e3; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #4338ca; }
.btn.fb { background: var(--fb); border-color: var(--fb); color: #fff; }
.btn.fb:hover { background: #0f63d1; }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-bg); border-color: #f5c2bd; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 11px 20px; font-size: 15px; border-radius: 10px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
label.field > small { display: block; color: var(--text-3); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font: 14px var(--font); color: var(--text); background: #fff; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 80px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
input.invalid { border-color: var(--err); }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; }
.copy { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel-2); }
.copy code { flex: 1; background: none; padding: 9px 11px; overflow: auto; white-space: nowrap; font-size: 12.5px; }
.copy button { border: 0; border-left: 1px solid var(--line); background: #fff; padding: 0 12px; cursor: pointer; font: 600 12.5px var(--font); color: var(--accent); }
.copy button:hover { background: var(--accent-2); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.accent { background: var(--accent-2); color: var(--accent-ink); }
.badge.new { background: #f59e0b; color: #fff; }
.badge.new::before { display: none; }

/* ---------- alerts ---------- */
.alert { border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid; }
.alert .ico { font-size: 16px; line-height: 1.3; }
.alert.info { background: var(--info-bg); border-color: #cfdcfb; color: #1e3a8a; }
.alert.warn { background: var(--warn-bg); border-color: #f8deb0; color: #7c3a0a; }
.alert.err { background: var(--err-bg); border-color: #f5c9c4; color: #8b1d13; }
.alert.ok { background: var(--ok-bg); border-color: #bfe6cf; color: #0b5d36; }
.alert b { font-weight: 650; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fafbff; }
table.t tr.sel td { background: #f4f3ff; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* ---------- checklist ---------- */
.progress { height: 8px; background: var(--line-2); border-radius: 10px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, #6366f1, #22c55e); border-radius: 10px; transition: width .4s; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; background: var(--line-2); color: var(--text-2); }
.steps li.done .n { background: var(--ok); color: #fff; }
.steps li.next .n { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-2); }
.steps li.done .t { color: var(--text-2); }

/* ---------- wizard ---------- */
.wizard-steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.wizard-steps div { flex: 1; min-width: 110px; padding: 8px 10px; border-radius: 9px; background: var(--line-2); font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.wizard-steps div.on { background: var(--accent-2); color: var(--accent-ink); }
.wizard-steps div.done { background: var(--ok-bg); color: var(--ok); }
.guide { counter-reset: g; list-style: none; padding: 0; margin: 0; }
.guide > li { counter-increment: g; position: relative; padding: 0 0 14px 38px; }
.guide > li::before { content: counter(g); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-2); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; font-size: 12px; }
.guide > li b { font-weight: 650; }
.guide .path { display: inline-block; background: var(--line-2); border-radius: 6px; padding: 1px 7px; font-size: 12.5px; font-weight: 600; color: var(--text); }
details.help { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
details.help > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--accent-ink); list-style: none; }
details.help > summary::before { content: "▸ "; }
details.help[open] > summary::before { content: "▾ "; }
details.help > div { padding: 0 14px 14px; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 10px; padding: 6px 0; align-items: flex-start; }
.checks .i { width: 20px; text-align: center; flex: none; font-weight: 700; }
.checks .ok { color: var(--ok); }
.checks .err { color: var(--err); }
.checks .warn { color: var(--warn); }

/* ---------- page cards ---------- */
.pg { display: flex; gap: 14px; align-items: flex-start; }
.pg img, .pg .ph { width: 44px; height: 44px; border-radius: 10px; flex: none; object-fit: cover; background: var(--fb); color: #fff; display: grid; place-items: center; font-weight: 700; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv > div:nth-child(odd) { color: var(--text-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .7; margin-left: 4px; }

/* ---------- modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 18, 40, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; box-shadow: var(--shadow-lg); animation: pop .18s; }
.modal.wide { max-width: 860px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-b { padding: 20px 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; background: var(--panel-2); border-radius: 0 0 14px 14px; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-3); padding: 4px; }
.drawer-wrap { position: fixed; inset: 0; background: rgba(15, 18, 40, .35); z-index: 50; animation: fade .15s; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(640px, 100%); background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s; }
.drawer .modal-b { overflow: auto; flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #171a26; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 420px; animation: pop .2s; font-size: 13.5px; }
.toast.err { background: #a8261b; }
.toast.ok { background: #0b7a45; }

/* ---------- bars ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .col { width: 100%; max-width: 32px; background: #c7d2fe; border-radius: 5px 5px 0 0; position: relative; min-height: 2px; }
.bars .col .okp { position: absolute; bottom: 0; left: 0; right: 0; background: var(--accent); border-radius: 5px 5px 0 0; }
.bars .d { font-size: 10.5px; color: var(--text-3); }
.bars .n { font-size: 11px; color: var(--text-2); font-weight: 600; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, #e0e7ff, transparent), var(--bg); }
.auth .card { width: 100%; max-width: 420px; padding: 30px; }
.auth h1 { margin-bottom: 6px; }

.stage-g { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.g-new { background: #94a3b8; } .g-yellow { background: #f59e0b; } .g-blue { background: #3b82f6; } .g-green { background: #16a34a; } .g-red { background: #dc2626; } .g-service { background: #8b5cf6; } .g-unknown { background: #cbd5e1; }
.var { cursor: pointer; }
pre.log { background: #0f1225; color: #d5d9f0; padding: 12px 14px; border-radius: 10px; font-size: 12px; overflow: auto; white-space: pre-wrap; max-height: 340px; margin: 0; }
.ws-card .avatar { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 16px; flex: none; }
.radio-card { border: 1.5px solid var(--line); border-radius: 11px; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.radio-card:hover { border-color: #c7cbe0; }
.radio-card.on { border-color: var(--accent); background: #fafaff; }
.radio-card input { margin-top: 4px; }
.sep { height: 1px; background: var(--line-2); margin: 16px 0; }
