:root{
 --bg:#0b0f14;--surface:#131a22;--surface2:#1a232e;--border:#223041;
 --text:#e6edf3;--muted:#8b98a5;--accent:#34d399;--red:#f87171;--amber:#fbbf24;
 --blue:#60a5fa;--radius:12px;
 --mono:ui-monospace,'SF Mono','Cascadia Code',Menlo,Consolas,monospace;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
 background:var(--bg);color:var(--text);
 font:14px/1.45 system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
}
a{color:var(--blue);text-decoration:none}
button{font:inherit;cursor:pointer;border:none;background:none;color:inherit}

/* ---------- login ---------- */
#app{min-height:100vh}
.login-wrap{
 min-height:100vh;display:flex;align-items:center;justify-content:center;
 background:radial-gradient(600px 400px at 30% 20%,#12202c 0%,var(--bg) 60%);
}
.login-card{
 width:360px;background:var(--surface);border:1px solid var(--border);
 border-radius:16px;padding:32px 28px;box-shadow:0 20px 60px rgba(0,0,0,.45);
}
.login-card .logo{display:flex;align-items:center;gap:10px;margin-bottom:6px}
.login-card .logo svg{width:34px;height:34px}
.login-card h1{font-size:20px;font-weight:650;letter-spacing:.2px}
.login-card .sub{color:var(--muted);font-size:13px;margin-bottom:22px}
.field{margin-bottom:14px}
.field label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px;font-weight:600;letter-spacing:.3px}
.field input{
 width:100%;padding:10px 12px;background:var(--bg);color:var(--text);
 border:1px solid var(--border);border-radius:10px;font-size:14px;outline:none;
 transition:border .15s;
}
.field input:focus{border-color:var(--accent)}
.btn-primary{
 width:100%;padding:10px;background:var(--accent);color:#052e22;font-weight:650;
 border-radius:10px;transition:filter .15s;
}
.btn-primary:hover{filter:brightness(1.08)}
.login-err{margin-top:14px;padding:9px 12px;border-radius:8px;font-size:13px;display:none}
.login-err.red{display:block;background:rgba(248,113,113,.1);color:var(--red);border:1px solid rgba(248,113,113,.3)}
.login-err.amber{display:block;background:rgba(251,191,36,.08);color:var(--amber);border:1px solid rgba(251,191,36,.3)}

/* ---------- layout ---------- */
.layout{display:flex;min-height:100vh}
.sidebar{
 width:232px;flex:none;background:var(--surface);border-right:1px solid var(--border);
 display:flex;flex-direction:column;padding:18px 12px;position:sticky;top:0;height:100vh;
}
.sidebar .logo{display:flex;align-items:center;gap:10px;padding:0 10px 18px}
.sidebar .logo svg{width:30px;height:30px}
.sidebar .logo b{font-size:16px;font-weight:700;letter-spacing:.3px}
.nav-item{
 display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:10px;
 color:var(--muted);font-weight:550;transition:background .15s,color .15s;
}
.nav-item svg{width:17px;height:17px}
.nav-item:hover{background:var(--surface2);color:var(--text)}
.nav-item.active{background:rgba(52,211,153,.1);color:var(--accent)}
.sidebar .spacer{flex:1}
.userbox{
 display:flex;align-items:center;gap:10px;padding:10px 12px;
 border-top:1px solid var(--border);
}
.avatar{
 width:30px;height:30px;border-radius:50%;background:var(--surface2);
 display:flex;align-items:center;justify-content:center;font-weight:700;
 color:var(--blue);font-size:13px;border:1px solid var(--border);
}
.userbox .name{font-size:13px;font-weight:600;flex:1}
.userbox button{color:var(--muted);display:flex;padding:4px;border-radius:6px}
.userbox button:hover{color:var(--red);background:var(--surface2)}

.main{flex:1;padding:24px 28px;max-width:1240px}
.topbar{display:flex;align-items:center;gap:14px;margin-bottom:22px}
.topbar h2{font-size:19px;font-weight:650}
.live{display:flex;align-items:center;gap:7px;color:var(--muted);font-size:12.5px;font-weight:600}
.live .dot{width:8px;height:8px;border-radius:50%;background:var(--accent);animation:pulse 1.8s infinite}
.live.off .dot{background:var(--muted);animation:none}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.35}}
.topbar .spacer{flex:1}
.btn-ghost{
 padding:7px 14px;border:1px solid var(--border);border-radius:9px;color:var(--muted);
 font-size:13px;font-weight:600;transition:.15s;
}
.btn-ghost:hover{color:var(--text);border-color:var(--muted);background:var(--surface2)}

/* stats */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px;margin-bottom:20px}
.stat{
 background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
 padding:16px 18px;
}
.stat .v{font-size:26px;font-weight:700;letter-spacing:.3px}
.stat .k{font-size:12px;color:var(--muted);font-weight:600;margin-top:2px;letter-spacing:.3px}
.stat.green .v{color:var(--accent)}
.stat.red .v{color:var(--red)}
.stat.blue .v{color:var(--blue)}

/* table */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th{
 text-align:left;padding:11px 14px;color:var(--muted);font-size:11.5px;
 text-transform:uppercase;letter-spacing:.6px;border-bottom:1px solid var(--border);
 font-weight:650;
}
td{padding:12px 14px;border-bottom:1px solid rgba(34,48,65,.55)}
tbody tr{transition:background .12s;cursor:pointer}
tbody tr:hover{background:var(--surface2)}
tbody tr:last-child td{border-bottom:none}
.node-name{font-weight:650}
.node-sub{color:var(--muted);font-size:12px;font-family:var(--mono)}
.dot{
 display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:7px;
 vertical-align:middle;
}
.dot.on{background:var(--accent);animation:pulse 1.8s infinite}
.dot.off{background:var(--muted)}
.badge{
 display:inline-block;padding:3px 9px;border-radius:7px;font-size:11.5px;font-weight:650;
 background:var(--surface2);border:1px solid var(--border);color:var(--muted);
}
.badge.hub{color:var(--blue);border-color:rgba(96,165,250,.35)}
.mono{font-family:var(--mono);font-size:12.5px}
.rtt.g{color:var(--accent);font-weight:650}
.rtt.a{color:var(--amber);font-weight:650}
.rtt.r{color:var(--red);font-weight:650}
.rowact{display:flex;gap:6px;justify-content:flex-end}
.iconbtn{
 padding:6px;border-radius:8px;border:1px solid var(--border);color:var(--muted);
 display:flex;transition:.12s;
}
.iconbtn:hover{color:var(--text);background:var(--surface2);border-color:var(--muted)}
.iconbtn svg{width:15px;height:15px}
.empty{padding:38px;text-align:center;color:var(--muted)}

/* drawer */
.overlay{
 position:fixed;inset:0;background:rgba(4,8,12,.55);z-index:40;
 opacity:0;pointer-events:none;transition:opacity .18s;
}
.overlay.show{opacity:1;pointer-events:auto}
.drawer{
 position:fixed;top:0;right:-420px;width:410px;height:100vh;z-index:41;
 background:var(--surface);border-left:1px solid var(--border);
 transition:right .22s ease;overflow-y:auto;
}
.drawer.show{right:0}
.drawer .head{
 display:flex;align-items:center;gap:10px;padding:18px 20px;
 border-bottom:1px solid var(--border);
}
.drawer .head h3{font-size:16px;flex:1}
.drawer .head .close{color:var(--muted);font-size:20px;padding:2px 8px;border-radius:6px}
.drawer .head .close:hover{background:var(--surface2);color:var(--text)}
.drawer .section{padding:16px 20px;border-bottom:1px solid rgba(34,48,65,.55)}
.drawer .section h4{
 font-size:11.5px;color:var(--muted);text-transform:uppercase;
 letter-spacing:.6px;margin-bottom:10px;font-weight:650;
}
.kv{display:flex;justify-content:space-between;padding:4px 0;font-size:13px}
.kv .k{color:var(--muted)}
.spark{width:100%;height:64px}
.speed-big{font-size:22px;font-weight:700;font-family:var(--mono)}
.speed-big .d{color:var(--accent)}
.speed-big .u{color:var(--blue)}
.speed-big .sep{color:var(--muted);margin:0 8px}
.btn-accent{
 width:100%;padding:9px;background:var(--accent);color:#052e22;font-weight:650;
 border-radius:9px;margin-top:6px;transition:filter .15s;
}
.btn-accent:hover{filter:brightness(1.08)}
.sw-list{display:flex;flex-direction:column;gap:8px}
.sw-item{
 padding:9px 12px;background:var(--bg);border:1px solid var(--border);
 border-radius:9px;font-size:12.5px;display:flex;flex-direction:column;gap:2px;
}
.sw-item .route{font-family:var(--mono);color:var(--blue)}
.sw-item .meta{color:var(--muted);font-size:11.5px}

/* toasts */
.toasts{position:fixed;top:18px;right:18px;z-index:60;display:flex;flex-direction:column;gap:8px}
.toast{
 min-width:250px;padding:11px 14px;border-radius:10px;font-size:13px;font-weight:550;
 border:1px solid var(--border);background:var(--surface2);
 box-shadow:0 10px 30px rgba(0,0,0,.4);animation:slidein .2s ease;
}
@keyframes slidein{from{transform:translateX(30px);opacity:0}to{transform:none;opacity:1}}
.toast.ok{border-color:rgba(52,211,153,.4)}
.toast.err{border-color:rgba(248,113,113,.4)}

/* tests table */
.test-ok{color:var(--accent)}
.test-fail{color:var(--red)}
