:root { --bg:#0f172a; --panel:#111827; --card:#1f2937; --text:#e5e7eb; --muted:#9ca3af; --accent:#60a5fa; --ok:#34d399; --warn:#fbbf24; --bad:#f87171; }
*{ box-sizing:border-box; }
body{ margin:0; font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif; background:linear-gradient(160deg,#0b1020,#0f172a); color:var(--text); }
header{ padding:16px 24px; display:flex; align-items:center; justify-content:space-between; background:rgba(0,0,0,.2); border-bottom:1px solid #222; }
header h1{ font-size:18px; margin:0; color:#c7d2fe; }
#layout{ display:grid; grid-template-columns: 160px minmax(0,2fr) minmax(320px,1fr); gap:16px; padding:16px; }
#board,#sidebar{ background:var(--panel); border:1px solid #222; border-radius:10px; padding:16px; }

/* Make network fill available width; height is set by JS */
#network{ position:relative; width:100%; height:580px; margin:0 auto; background:#0b1224; border:1px dashed #2a3b5f; border-radius:12px; overflow:hidden; }

.subnet{ position:absolute; z-index:1; background:rgba(13,19,38,0.6); border:1px solid #2a3b5f; border-radius:10px; box-shadow:inset 0 0 0 1px rgba(255,255,255,0.02); cursor:pointer; }
.subnet.isolated{ border-style:dashed; border-color:#7dd3fc; }
/* FLEX title bar */
.subnet-title{ position:absolute; left:8px; top:6px; font-size:12px; color:#93c5fd; opacity:.9; display:flex; align-items:center; gap:8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; min-width:0; }
.subnet-title .badge{ flex:0 0 auto; margin-left:auto; }

#network .node{ position:absolute; z-index:2; padding:10px 12px; background:var(--card); border:1px solid #2b3445; border-radius:8px; cursor:pointer; transition:transform .08s ease, box-shadow .2s ease; user-select:none; font-size:14px; max-width:190px; min-height:48px; line-height:20px; display:flex; align-items:flex-start; gap:8px; }
#network .node:hover{ transform:translateY(-2px); box-shadow:0 6px 18px rgba(0,0,0,.3); }
#network .node .label{ flex:1 1 auto; min-width:0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; white-space:normal; line-height:18px; color:var(--text); }
#network .node .badge{ flex:0 0 auto; position:static; margin-left:0; font-weight:600; }

.badge{ display:inline-block; padding:2px 6px; border-radius:6px; font-size:12px; margin-left:6px; }
.badge.status-up{ background:#0f2a3b; color:#34d399; border:1px solid #245a60; }
.badge.status-compromised{ background:#3b1d1d; color:#fca5a5; border:1px solid #5c2b2b; }
.badge.status-encrypted{ background:#3b1d35; color:#f472b6; border:1px solid #5b2b53; }
.badge.status-down{ background:#2b2b2b; color:#bbb; border:1px solid #444; }
.badge.status-isolated{ background:#0f2a3b; color:#93c5fd; border:1px solid #274a6e; }

#links{ position:absolute; left:0; top:0; width:100%; height:100%; pointer-events:none; z-index:1; }

#kpis{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
.kpi{ background:#0d1326; border:1px solid #1f2a44; border-radius:10px; padding:10px; }
.kpi h4{ margin:0 0 6px 0; font-size:12px; color:#93c5fd; }
.bar{ width:100%; height:8px; background:#1f2937; border-radius:999px; overflow:hidden; }
.bar .fill{ height:8px; background:linear-gradient(90deg,#60a5fa,#22d3ee); width:50%; }

#log{ height:220px; overflow:auto; background:#0d1326; border:1px solid #1f2a44; border-radius:10px; padding:10px; }
.logline{ font-size:13px; color:#cbd5e1; border-bottom:1px dashed #1f2a44; padding:6px 0; }
.logline .ts{ color:#64748b; margin-right:8px; }
.logline .type{ font-weight:700; color:#93c5fd; margin-right:8px; }
.logline .sev{ color:#fbbf24; margin-right:8px; }
.logline .node{ color:#9ca3af; margin-left:8px; position:static; display:inline; }

#controls{ display:flex; gap:8px; align-items:center; }
#controls .split{ display:flex; align-items:center; gap:8px; }
#controls button{ background:var(--accent); color:#0b1020; border:none; padding:10px 12px; border-radius:8px; cursor:pointer; font-weight:600; }
#controls button.secondary{ background:#374151; color:#e5e7eb; }
#contextMenu{ position:fixed; z-index:10000; display:none; min-width:220px; background:#0f172a; border:1px solid #22304d; border-radius:8px; box-shadow:0 12px 30px rgba(0,0,0,.45); overflow:hidden; }
#contextMenu button{ display:block; width:100%; padding:10px 12px; background:transparent; border:none; color:#e5e7eb; text-align:left; cursor:pointer; border-bottom:1px solid #1b243b; font-size:14px; }
#contextMenu button:hover{ background:#15213c; }
.toast{ position:fixed; right:16px; bottom:16px; background:#111827; color:#e5e7eb; border:1px solid #374151; padding:10px 14px; border-radius:8px; box-shadow:0 8px 20px rgba(0,0,0,.35); display:none; }
.toast.show{ display:block; }
.artifacts{ margin-top:8px; background:#0d1326; border:1px solid #1f2a44; border-radius:10px; padding:10px; max-height:240px; overflow:auto; }
.artifact{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px; border-bottom:1px dashed #1f2a44; }
.artifact .meta{ font-size:12px; color:#9ca3af; }
.overlay{ position:fixed; inset:0; background:rgba(0,0,0,.55); display:none; align-items:center; justify-content:center; z-index:20000; }
.overlay.show{ display:flex; }
.overlay .panel{ background:#111827; border:1px solid #22304d; border-radius:12px; padding:24px; width:420px; text-align:center; box-shadow:0 20px 50px rgba(0,0,0,.5); }
.overlay .panel h2{ margin:0 0 8px 0; color:#c7d2fe; }



#appsPanel{ background:var(--panel); border:1px solid #222; border-radius:10px; padding:12px; overflow:hidden; }
#appsPanel h3{ margin:0 0 10px 0; color:#c7d2fe; font-size:13px; }
.appCard{ border:1px solid #1f2a44; background:#0d1326; border-radius:10px; padding:8px; margin-bottom:10px; cursor:pointer; }
.appCard:hover{ border-color:#2a3b5f; }
.appHeader{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; }
.appAcr{ display:flex; align-items:center; gap:6px; font-weight:700; letter-spacing:0.5px; font-size:13px; }
.appDot{ width:9px; height:9px; border-radius:999px; background:#fff; }
.appState{ font-size:11px; color:var(--muted); }
.appBar{ width:100%; height:8px; background:#1f2937; border-radius:999px; overflow:hidden; }
.appBar .fill{ height:8px; width:50%; background:#60a5fa; }
.appMeta{ margin-top:6px; font-size:11px; color:var(--muted); }
