/* Agent Map — obsidian-style graph view. Dark canvas, minimal chrome. */

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: #0d1117;
  color: #e6edf3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.tnum { font-variant-numeric: tabular-nums; }

/* ---------------- top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex: 0 0 auto;
  z-index: 5;
}

.tb-left, .tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.back {
  color: #58a6ff;
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  border: 1px solid #30363d;
  border-radius: 999px;
  background: #0d1117;
  white-space: nowrap;
}
.back:hover { border-color: #58a6ff; }

.counts {
  font-size: 12px;
  color: #8b949e;
  white-space: nowrap;
}

.mode-toggle {
  display: flex;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 999px;
  padding: 2px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: #8b949e;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.mode-btn.active {
  background: #238636;
  color: #fff;
}

.clock {
  font-size: 12px;
  color: #8b949e;
}

.mock-badge {
  font-size: 10px;
  font-weight: 700;
  color: #f0b429;
  border: 1px solid #f0b429;
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 1px;
}

/* ---------------- canvas ---------------- */

.canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #0d1117;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  touch-action: manipulation;
}

/* ---------------- legend ---------------- */

.legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #8b949e;
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 7px 11px;
  pointer-events: none;
  max-width: calc(100% - 24px);
}

.legend .lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend .sw { font-style: normal; font-weight: 700; font-size: 13px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend .dot.on { background: #3fb950; box-shadow: 0 0 6px #3fb950; }
.legend .dot.off { background: #484f58; }

/* ---------------- reconnecting badge ---------------- */

.recon {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #f0b429;
  background: rgba(22, 27, 34, 0.92);
  border: 1px solid #9e6a03;
  border-radius: 999px;
  padding: 5px 14px;
  pointer-events: none;
}

/* ---------------- tooltip ---------------- */

.tooltip {
  position: absolute;
  width: 250px;
  max-width: calc(100% - 24px);
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  padding: 12px 14px;
  font-size: 12px;
  z-index: 10;
}

.tt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tt-name {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #8b949e;
  margin-bottom: 10px;
}

.tt-status .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tt-status .dot.on { background: #3fb950; box-shadow: 0 0 6px #3fb950; }
.tt-status .dot.off { background: #484f58; }

.tt-close {
  border: 0;
  background: transparent;
  color: #8b949e;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.tt-close:hover { color: #e6edf3; }

.tt-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: #8b949e;
}
.tt-row b { color: #e6edf3; font-weight: 600; }

.tt-latest {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #30363d;
  color: #8b949e;
  line-height: 1.45;
  word-break: break-word;
}
.tt-latest .ago { color: #6e7681; font-size: 11px; }

/* ---------------- small screens ---------------- */

@media (max-width: 560px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .counts { display: none; }
  .tooltip { width: 220px; }
}
