:root {
  color-scheme: dark;
  --bg: #0e0e15;
  --surface: #15151f;
  --card: #1a1a27;
  --line: #272737;
  --text: #f0eef8;
  --muted: #a4a2b9;
  --quiet: #85839e;
  --accent: #aa96ff;
  --green: #54dbad;
  --red: #fb8290;
  --yellow: #f0be74;
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 75% -40%, #241b3d 0, transparent 62%), var(--bg); color: var(--text); min-width: 320px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, .board:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.top { height: 66px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #222230; background: #11111acc; }
.brand { display: flex; align-items: center; text-decoration: none; color: var(--text); font-weight: 750; letter-spacing: -.5px; font-size: 19px; }
.brand > span:last-child { color: #b6a6fb; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 10px; border: 1px solid #6c55b6; background: #30234c; border-radius: 10px; color: #c4b1ff; font-size: 24px; }
.top-actions, .filters, .actions { display: flex; gap: 9px; align-items: center; }
.demo { border: 1px solid #463c61; border-radius: 6px; padding: 3px 8px; color: #c0acee; font-size: 12px; }
.button, select { border: 1px solid #323245; background: #1b1b28; border-radius: 8px; padding: 8px 13px; white-space: nowrap; }
.button:hover, select:hover { background: #252438; }
.button.primary { background: #ad97ff; color: #1c103c; border-color: #bba8ff; font-weight: 700; }
.button.primary:hover { background: #c0aeff; }
.button.icon { min-width: 37px; padding-inline: 8px; }
#dashboard { padding: 28px 34px 22px; max-width: 1900px; margin: auto; }
.intro { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 23px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 36px); letter-spacing: -1.3px; line-height: 1.18; }
.intro p, .login p { color: var(--muted); margin-top: 6px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { background: linear-gradient(135deg,#191926,#15151f); border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: center; gap: 13px; padding: 13px 15px; }
.metric .glyph { width: 38px; height: 38px; flex: 0 0 38px; }
.metric b { display: block; font-size: 23px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); }
.glyph { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #2b2245; color: #c0aaff; font-size: 17px; }
.glyph.green { background: #18332f; color: var(--green); }
.glyph.blue { background: #222b46; color: #9ab6ff; }
.glyph.amber { background: #362b29; color: var(--yellow); }
.workspace { border: 1px solid #303043; border-radius: 13px; overflow: hidden; background: #13131d; }
.toolbar { padding: 10px 13px 10px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 10px; }
.board-title { display: flex; align-items: center; gap: 8px; font-weight: 680; }
.board-title span { color: var(--accent); font-size: 17px; }
.toolbar select { max-width: 170px; padding-block: 6px; }
.search { display: flex; align-items: center; gap: 5px; border: 1px solid #323245; background: #11111b; border-radius: 8px; padding: 4px 8px; color: var(--quiet); }
.search > span { font-size: 18px; line-height: 1; }
.search input { width: min(16vw, 175px); background: transparent; padding: 2px; border: 0; color: var(--text); outline: none; }
.search:focus-within { border-color: var(--accent); }
kbd { border: 1px solid #343346; background: #222231; border-radius: 4px; padding: 0 5px; }
.workbody { display: flex; min-width: 0; height: max(460px, calc(100dvh - 390px)); position: relative; }
.board { position: relative; overflow: hidden; flex: 1; min-width: 0; cursor: grab; background: radial-gradient(circle, #343047 1px, transparent 1.2px) 0 0/19px 19px, #101019; touch-action: none; }
.board.dragging { cursor: grabbing; }
#world { position: absolute; transform-origin: 0 0; left: 0; top: 0; }
#links, .zone, .node, .hub { position: absolute; }
#links { pointer-events: none; }
.zone { border: 1px dashed #48425f; background: #1b172c59; border-radius: 13px; pointer-events: none; }
.zone-label { margin: 8px 10px; color: #bbb0da; font-size: 12px; font-weight: 650; }
.zone-label small { margin-left: 6px; color: #b1a3d8; background: #2d2542; padding: 1px 5px; border-radius: 4px; }
.node, .hub { width: 226px; text-align: left; border: 1px solid #3a374d; border-radius: 10px; background: #1b1a29; box-shadow: 0 4px 10px #08080d66; overflow: hidden; }
.node { cursor: grab; padding: 0; height: 96px; }
.node:hover { border-color: #8273ae; background: #201e32; }
.node.selected { border-color: #ad97ff; box-shadow: 0 0 0 2px #ad97ff32, 0 5px 18px #090713; background: #241e37; }
.node-head, .hub { display: flex; align-items: center; gap: 9px; padding: 10px; }
.node-head > div { min-width: 0; flex: 1; }
.node strong, .node small, .hub small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.node small, .hub small { color: var(--muted); font-size: 11px; }
.node-meta { padding: 6px 10px; border-top: 1px solid #363049; color: #beb7d4; font-size: 11px; display: flex; justify-content: space-between; gap: 4px; }
.node-meta span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hub { width: 177px; top: 264px; left: 54px; border-color: #6752a2; background: #241b3b; }
.dot { display: inline-block; height: 7px; width: 7px; flex: 0 0 7px; border-radius: 50%; background: #8c87a2; }
.dot.online { background: var(--green); box-shadow: 0 0 7px #54dbad60; }
.dot.stale { background: var(--yellow); }
.dot.offline { background: var(--red); }
.board-controls { position: absolute; bottom: 13px; left: 13px; display: flex; align-items: center; border: 1px solid #3a354e; background: #1a1928; border-radius: 8px; overflow: hidden; color: var(--muted); }
.board-controls button { border: 0; background: transparent; width: 34px; height: 34px; font-size: 17px; }
.board-controls button:hover, #minimap:hover { background: #29243e; }
.board-controls span { min-width: 42px; text-align: center; font-size: 11px; }
#fit { border-left: 1px solid #3a354e; }
#minimap { position: absolute; bottom: 13px; right: 13px; border: 1px solid #373149; background: #171624; border-radius: 8px; padding: 3px; }
#minimap canvas { display: block; max-width: 100%; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 17px; padding: 9px 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.legend .dot { margin-right: 3px; vertical-align: 1px; }
#sync { margin-left: auto; }
.detail { position: absolute; inset: 0 0 0 auto; width: min(340px, 86%); z-index: 2; box-shadow: -10px 0 24px #08080eb0; background: #15151f; border-left: 1px solid #302d43; display: flex; flex-direction: column; min-width: 0; }
.detail-top { padding: 15px 15px 12px; }
.detail-title { display: flex; align-items: center; gap: 9px; }
.detail-title > div { flex: 1; min-width: 0; }
.detail-title h2 { font-size: 17px; overflow-wrap: anywhere; }
.detail-title small, .metadata dt, .subtle { color: var(--muted); }
.close { background: transparent; border: 0; font-size: 21px; color: var(--muted); padding: 0 5px; }
.tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: 0 0 auto; }
.tabs button { flex: 1; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 5px; color: var(--muted); font-size: 11px; }
.tabs button.active { color: #ccbaff; border-bottom-color: #ae98ff; }
.detail-body { flex: 1; overflow: auto; padding: 13px 15px; }
.detail-body h3 { font-size: 12px; color: #ded8f1; margin: 13px 0 7px; }
.detail-body h3:first-child { margin-top: 0; }
.metadata { display: grid; grid-template-columns: minmax(75px, auto) minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 12px; }
.metadata dd { margin: 0; overflow-wrap: anywhere; }
.status { color: var(--green); }
.status.stale { color: var(--yellow); }
.status.offline { color: var(--red); }
.status.pending { color: var(--muted); }
.load { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.load > div { border: 1px solid var(--line); background: #1d1b2b; padding: 7px; border-radius: 7px; }
.load b { display: block; font-size: 15px; }
.load small { color: var(--muted); }
progress { display: block; width: 100%; height: 4px; margin-top: 6px; accent-color: var(--accent); }
.item { padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 5px; overflow-wrap: anywhere; }
.item small { display: block; color: var(--muted); }
.detail-foot { display: flex; gap: 7px; padding: 9px 12px; border-top: 1px solid var(--line); }
.detail-foot button { font-size: 11px; padding: 6px 9px; }
.empty { display: grid; place-items: center; align-content: center; gap: 4px; height: 100%; pointer-events: none; position: absolute; inset: 0; color: var(--muted); }
.empty b { color: var(--text); font-size: 17px; }
.login { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 20px; }
.login form, dialog { color: var(--text); background: #191824; border: 1px solid #39334e; padding: 24px; border-radius: 14px; width: min(100%, 460px); }
.login h1 { margin-top: 13px; font-size: 26px; }
.login label { margin: 18px 0 12px; }
.login .primary { width: 100%; }
dialog { width: min(570px, calc(100% - 24px)); }
dialog::backdrop { background: #0a0912ba; }
dialog header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
dialog p { color: var(--muted); margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
form input { padding: 8px; border: 1px solid #3c3650; border-radius: 6px; background: #11101b; color: var(--text); width: 100%; }
.wide { grid-column: 1/-1; }
dialog .actions { margin-top: 14px; flex-wrap: wrap; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 9px; background: #10101a; border-radius: 7px; }
#toast { position: fixed; bottom: 22px; right: 22px; z-index: 3; background: #28213d; border: 1px solid #625189; padding: 10px 15px; border-radius: 8px; max-width: calc(100% - 44px); }
@media (max-width: 790px) {
  #dashboard { padding: 18px 12px; }
  .top { padding: 0 12px; height: 56px; }
  .search input { width: 110px; }
}
@media (max-width: 530px) {
  .intro { align-items: flex-start; flex-direction: column; }
  .intro p { font-size: 12px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 7px; }
  .metric { padding: 7px; gap: 8px; }
  .toolbar { flex-wrap: wrap; }
  .filters { flex-wrap: wrap; }
  .workbody { height: 550px; }
  .legend #sync { margin-left: 0; }
}

#host-details {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 1;
  color: #decfff;
  border-color: #51446e;
  box-shadow: 0 3px 12px #08080d66;
}
.node-expand {
  display: inline-grid;
  place-items: center;
  margin-left: 4px;
  width: 15px;
  line-height: 15px;
  border-radius: 4px;
  background: #312649;
  color: #ccb8ff;
}
.service-zone {
  border-color: #685485;
  background: #22193532;
}
.service-zone .zone-label {
  margin: 9px 13px;
  color: #d7c6f7;
  font-size: 13px;
}
.service-empty {
  margin: 25px 13px 0;
  color: var(--muted);
  font-size: 12px;
}
.service-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid #463957;
  border-radius: 8px;
  background: #1d192b;
  text-align: left;
}
.service-node:hover { background: #29203d; border-color: #ad97ff; }
.service-icon {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  height: 24px;
  border-radius: 6px;
  background: #33254c;
  color: #c4a8f4;
}
.service-copy { flex: 1; min-width: 0; }
.service-copy strong, .service-copy small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.service-copy strong { font-size: 13px; font-weight: 650; }
.service-copy small { color: var(--muted); font-size: 10px; }
