:root {
  --bg: #0b0a10;
  --panel: #111018;
  --panel2: #17151f;
  --panel3: #1e1b29;
  --line: #262233;
  --line2: #35304a;
  --text: #ebe8f2;
  --muted: #8f899f;
  --p1: #7c3aed;
  --p2: #8b5cf6;
  --p3: #a78bfa;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --px: 'Press Start 2P', monospace;
  --body: 'Pixelify Sans', 'Segoe UI', sans-serif;
  --mono: 'VT323', Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: transparent; overflow: hidden; font-family: var(--body); font-size: 15px; color: var(--text); user-select: none; }
body.web { background: var(--bg); }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--p1); }

#app { position: fixed; inset: 0; background: rgba(6, 5, 10, .7); display: flex; align-items: center; justify-content: center; }
.panel { position: relative; width: min(1440px, 95vw); height: min(850px, 92vh); display: flex; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); overflow: hidden; }
body.web #app { background: var(--bg); }
body.web .panel { width: 100vw; height: 100vh; border: 0; border-radius: 0; box-shadow: none; }

.side { width: 232px; background: #0e0d14; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px 16px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; padding: 0 4px; }
.logo { width: 38px; height: 38px; flex-shrink: 0; background: var(--p1); border-radius: 8px; display: grid; place-items: center; }
.logo i { width: 15px; height: 18px; background: #fff; clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }
.brand-title { font-family: var(--px); font-size: 10px; line-height: 1.6; color: #fff; }
.brand-sub { font-size: 13px; color: var(--muted); }
nav { display: flex; flex-direction: column; gap: 3px; }
.tab { display: flex; align-items: center; text-align: left; background: transparent; border: 0; border-left: 3px solid transparent; border-radius: 6px; color: var(--muted); padding: 10px 12px; font: 500 16px var(--body); cursor: pointer; transition: background .12s, color .12s; }
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active { color: #fff; background: rgba(124, 58, 237, .16); border-left-color: var(--p2); }
.tcount { margin-left: auto; font-family: var(--mono); font-size: 18px; font-weight: 400; color: var(--p3); pointer-events: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.status { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel2); font-size: 14px; color: var(--ok); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status.test { color: var(--warn); }
.status.test i { background: var(--warn); }
.keys { font-size: 13px; color: var(--muted); padding: 0 4px; }
.keys b { font-family: var(--mono); font-size: 15px; font-weight: 400; color: var(--text); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; margin: 0 3px 0 6px; }
.keys b:first-child { margin-left: 0; }

main { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; }
header { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
header h1 { font-family: var(--px); font-size: 13px; font-weight: 400; color: #fff; }
.head-right { display: flex; gap: 8px; align-items: center; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; color: var(--text); padding: 8px 12px; font: 400 15px var(--body); outline: none; }
input::placeholder, textarea::placeholder { color: #625c73; }
input:focus, select:focus, textarea:focus { border-color: var(--p2); }
#search { width: 250px; }
.btn { background: var(--p1); border: 1px solid var(--p1); border-radius: 6px; color: #fff; padding: 8px 14px; font: 500 15px var(--body); cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--p2); border-color: var(--p2); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.ghost { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.btn.ghost:hover { border-color: var(--p2); background: var(--panel3); }
.btn.on { border-color: var(--p2); color: var(--p3); }
.btn.danger { background: #b91c1c; border-color: #b91c1c; }
.btn.danger:hover { background: #dc2626; border-color: #dc2626; }
.btn.warn { background: var(--panel2); border-color: #92610a; color: var(--warn); }
.btn.warn:hover { background: #2a2110; border-color: var(--warn); }
.btn.sm { padding: 4px 9px; font-size: 13px; }

.page { display: none; flex: 1; min-height: 0; position: relative; }
.page.active { display: flex; flex-direction: column; }
.chips { display: flex; gap: 6px; padding: 12px 18px 0; }
.chip { background: transparent; border: 1px solid var(--line2); border-radius: 999px; color: var(--muted); padding: 4px 12px; font: 500 14px var(--body); cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { color: #fff; border-color: var(--p2); background: rgba(124, 58, 237, .18); }
.split { display: flex; flex: 1; min-height: 0; }
.list-wrap { flex: 1; overflow: auto; padding: 8px 18px 74px; }
.list-wrap.full { padding-bottom: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 10px; position: sticky; top: 0; background: var(--panel); z-index: 1; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table th[data-sort] { cursor: pointer; }
.table th[data-sort]:hover { color: var(--text); }
.table th.sorted { color: var(--p3); }
.table th.sorted::after { content: ' ▾'; }
.table th.sorted.asc::after { content: ' ▴'; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.table tbody tr.click { cursor: pointer; }
.table tbody tr:hover td { background: var(--panel2); }
.table tbody tr.sel td { background: rgba(124, 58, 237, .14); }
.table tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--p2); }
.table tbody tr.risk td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.w-check { width: 34px; }
.chk { appearance: none; width: 16px; height: 16px; border: 1px solid var(--line2); border-radius: 4px; background: var(--bg); cursor: pointer; vertical-align: middle; padding: 0; }
.chk:checked { background: var(--p2); border-color: var(--p2); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 18px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; margin-left: 8px; border-radius: 4px; color: var(--p3); background: rgba(124, 58, 237, .16); vertical-align: middle; }
.tag.red { color: var(--bad); background: rgba(248, 113, 113, .12); }
.tag.cy { color: #93c5fd; background: rgba(96, 165, 250, .12); }
.tag.yel { color: var(--warn); background: rgba(251, 191, 36, .1); }

.trust { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.trust b { font-family: var(--mono); font-size: 20px; font-weight: 400; width: 30px; }
.bar { flex: 1; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.t-hi { color: var(--ok); } .t-mid { color: #bef264; } .t-low { color: var(--warn); } .t-crit { color: var(--bad); }
.b-hi { background: var(--ok); } .b-mid { background: #bef264; } .b-low { background: var(--warn); } .b-crit { background: var(--bad); }

.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; white-space: nowrap; }
.a-log { color: var(--p3); background: rgba(124, 58, 237, .16); }
.a-kick { color: var(--warn); background: rgba(251, 191, 36, .1); }
.a-ban { color: var(--bad); background: rgba(248, 113, 113, .12); }
.a-off { color: var(--muted); background: var(--panel3); }
.s-active { color: var(--bad); font-weight: 600; } .s-done { color: var(--muted); }

.detail { width: 430px; border-left: 1px solid var(--line); overflow: auto; padding: 18px; background: #0e0d14; }
.empty { color: var(--muted); text-align: center; margin-top: 40%; }
.d-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ring { width: 64px; height: 64px; display: grid; place-items: center; flex-shrink: 0; border: 2px solid var(--line2); border-radius: 10px; background: var(--panel2); }
.ring b { font-family: var(--px); font-size: 15px; font-weight: 400; }
.d-name { font-size: 20px; font-weight: 600; word-break: break-all; }
.d-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.kv { background: var(--panel2); border-radius: 6px; padding: 7px 10px; }
.kv small { display: block; font-size: 12px; color: var(--muted); }
.kv span { font-family: var(--mono); font-size: 21px; }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.actions .btn { padding: 8px 6px; font-size: 14px; }
.h4 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.ids, .loglist, .parts, .notes { display: flex; flex-direction: column; gap: 4px; }
.ids div { background: var(--panel2); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.ids div:hover { color: #fff; background: var(--panel3); }
.part { display: flex; justify-content: space-between; gap: 10px; background: var(--panel2); border-radius: 6px; padding: 4px 10px; font-size: 14px; }
.part b { font-family: var(--mono); font-size: 19px; font-weight: 400; }
.logitem, .note { background: var(--panel2); border-radius: 6px; padding: 8px 10px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.logitem .l, .note .l { min-width: 0; }
.logitem .l div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note.warn { box-shadow: inset 3px 0 0 var(--warn); }
.note .l div:last-child { word-break: break-word; }
.noteadd { display: flex; gap: 6px; margin-top: 8px; }
.noteadd input { flex: 1; min-width: 0; }

.multibar { position: absolute; left: 18px; right: 448px; bottom: 14px; display: flex; gap: 10px; align-items: center; background: var(--panel3); border: 1px solid var(--p2); border-radius: 8px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); z-index: 3; }
.multibar span { flex: 1; }

.dash { overflow: auto; padding: 18px 22px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-content: start; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.card small { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.card .big { font-family: var(--px); font-size: 22px; color: #fff; }
.card .sub { margin-top: 10px; font-size: 14px; color: var(--muted); }
.card.c-bad .big { color: var(--bad); }
.card.c-ok .big { color: var(--ok); }
.card.c-cy .big { color: var(--p3); }
.span2 { grid-column: span 2; } .span4 { grid-column: span 4; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart .col i { width: 100%; min-height: 2px; background: var(--p2); border-radius: 3px 3px 0 0; }
.chart .col b { font-family: var(--mono); font-size: 18px; font-weight: 400; }
.chart .col span { font-family: var(--mono); font-size: 15px; color: var(--muted); }
.toprow { display: grid; grid-template-columns: 1fr 44px; gap: 4px 10px; align-items: center; margin-bottom: 9px; font-size: 14px; }
.toprow b { font-family: var(--mono); font-size: 19px; font-weight: 400; text-align: right; }
.toprow .bar { grid-column: span 2; }
.toprow .bar i { background: var(--p2); }
.feed { display: flex; flex-direction: column; }
.feedrow { display: grid; grid-template-columns: 84px 1fr 1.3fr 62px; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 7px 4px; font-size: 14px; }
.feedrow:last-child { border-bottom: 0; }
.feedrow.click { cursor: pointer; }
.feedrow.click:hover { background: var(--panel3); }
.feedrow > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; font-size: 14px; }
.facts div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 4px 0; }
.facts b { font-family: var(--mono); font-size: 19px; font-weight: 400; color: #fff; }

.watch { flex: 1; min-height: 0; padding: 14px 18px; display: grid; gap: 10px; overflow: auto; }
.watch.n1 { grid-template-columns: 1fr; }
.watch.n2 { grid-template-columns: 1fr 1fr; }
.watch.n3, .watch.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.watch.focus { grid-template-columns: 1fr 250px; grid-auto-rows: min-content; }
.watch.focus .wtile.big { grid-row: 1 / span 6; }
.watch-empty { margin: auto; text-align: center; color: var(--muted); max-width: 420px; line-height: 1.5; }
.wtile { position: relative; display: flex; flex-direction: column; background: #07060b; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; min-height: 0; }
.wtile.big { border-color: var(--p2); }
.wimg { position: relative; flex: 1; min-height: 110px; display: grid; place-items: center; color: var(--muted); font-size: 14px; cursor: pointer; overflow: hidden; }
.wimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.wlive { position: absolute; top: 8px; left: 8px; z-index: 1; display: flex; align-items: center; gap: 6px; font-size: 12px; background: rgba(0, 0, 0, .65); border-radius: 4px; padding: 2px 8px; }
.wlive i { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); }
.wbtns { position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; gap: 4px; }
.winfo { padding: 8px 12px; background: var(--panel2); border-top: 1px solid var(--line); font-size: 14px; }
.wname { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 5px; }
.wname .trust { min-width: 100px; }
.wbars { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 5px; }
.hp i { background: var(--ok); } .ar i { background: #60a5fa; }
.wmeta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; }

.set-top { display: flex; align-items: center; gap: 12px; padding: 14px 22px 0; }
.set-top .info { flex: 1; font-size: 14px; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch i { position: relative; width: 40px; height: 22px; border-radius: 11px; background: var(--line2); transition: background .12s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .12s; }
.switch.on i { background: var(--warn); }
.switch.on i::after { left: 21px; }
.settings { overflow: auto; padding: 14px 22px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); gap: 12px; align-content: start; }
.group { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.group h3 { font-size: 15px; font-weight: 600; color: var(--p3); margin-bottom: 8px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.srow:first-of-type { border-top: 0; }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg); flex-shrink: 0; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--muted); font: 500 13px var(--body); padding: 4px 9px; cursor: pointer; }
.seg button:hover { color: #fff; }
.seg button.on[data-a="off"] { background: var(--line2); color: #fff; }
.seg button.on[data-a="log"] { background: var(--p1); color: #fff; }
.seg button.on[data-a="kick"] { background: #b45309; color: #fff; }
.seg button.on[data-a="ban"] { background: #b91c1c; color: #fff; }

.modal { position: fixed; inset: 0; background: rgba(4, 3, 8, .7); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-box { width: 460px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.modal-box h3 { font-size: 18px; font-weight: 600; margin-bottom: 14px; }
#modal-body { display: flex; flex-direction: column; gap: 8px; }
#modal-body label { font-size: 13px; color: var(--muted); }
#modal-body textarea { min-height: 84px; resize: none; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 30; cursor: zoom-out; }
.viewer img { max-width: 92vw; max-height: 88vh; border-radius: 6px; }
.viewer-hint { margin-top: 10px; color: var(--muted); font-size: 14px; }

#toasts { position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { width: 340px; background: var(--panel); border: 1px solid var(--line2); border-left: 3px solid var(--p2); border-radius: 6px; padding: 10px 13px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: tin .2s ease; cursor: pointer; }
.toast.kick { border-left-color: var(--warn); }
.toast.ban { border-left-color: var(--bad); }
.toast b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 2px; }
@keyframes tin { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.warnscreen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .45); z-index: 60; pointer-events: none; }
.warn-box { width: 600px; background: var(--panel); border: 2px solid var(--warn); border-radius: 10px; padding: 28px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.warn-title { font-family: var(--px); font-size: 18px; color: var(--warn); margin-bottom: 18px; }
.warn-text { font-size: 20px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.warn-sub { margin-top: 12px; color: var(--muted); font-size: 15px; }
.warn-bar { margin-top: 18px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.warn-bar i { display: block; height: 100%; width: 100%; background: var(--warn); }

.login { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 40; }
.login-box { width: 340px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 26px; }
.login-box .brand { margin-bottom: 12px; padding: 0; }
.login-box .muted { font-size: 13px; text-align: center; }
.login-err { color: var(--bad); font-size: 14px; text-align: center; }

@media (max-width: 900px) {
  body.web .side { width: 170px; }
  body.web .detail { width: 320px; }
  body.web .multibar { right: 338px; }
  body.web .dash { grid-template-columns: 1fr 1fr; }
  body.web #search { width: 140px; }
}
