/* The appview canvas. Dark by default: this is a wall display, and the
   interesting thing on it is a few hundred small bright points. */

:root {
  --ink: #dfe4ec;
  --ink-dim: #78828f;
  --ground: #0b0d11;
  --panel: rgba(14, 17, 22, 0.82);
  --line: rgba(120, 130, 145, 0.22);
  --accent: #8fd0a0;
  --warn: #e0a08f;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font: 13px/1.5 var(--mono);
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
  cursor: grab;
}
#stage.dragging { cursor: grabbing; }

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

.bar {
  position: fixed;
  inset: 12px 12px auto 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(6px);
}

.mark { color: var(--accent); letter-spacing: 0.04em; }
.source {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
}
.source.live { color: var(--accent); border-color: rgba(143, 208, 160, 0.45); }
.sep { width: 1px; height: 18px; background: var(--line); }

.field { display: flex; align-items: center; gap: 6px; color: var(--ink-dim); }

input[type="search"] {
  width: 180px;
  padding: 3px 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
}
input[type="search"]:focus { outline: 1px solid var(--accent); }
input[type="range"] { width: 110px; accent-color: var(--accent); }
output { min-width: 42px; color: var(--ink); }

button {
  padding: 3px 10px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  cursor: pointer;
}
button:hover { color: var(--ink); }
button.on { color: var(--accent); border-color: rgba(143, 208, 160, 0.4); }

/* ---- side panel ---- */

.panel {
  position: fixed;
  top: 70px;
  right: 12px;
  bottom: 46px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(6px);
}

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; margin: 0; }
.stats div { display: flex; justify-content: space-between; gap: 8px; }
.stats dt { color: var(--ink-dim); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }

.panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: normal;
  color: var(--ink-dim);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.focus {
  padding: 8px;
  border: 1px solid rgba(143, 208, 160, 0.35);
  border-radius: 6px;
  background: rgba(143, 208, 160, 0.06);
}
.focus-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.focus-detail { margin: 6px 0 0; color: var(--ink-dim); word-break: break-all; }
/* Whether a work group is a crowd or a chain of command. Set apart from the
   detail above it, because it answers a different question about the same
   group: not who is on it, but whether any of them spawned each other. */
.focus-lineage {
  margin: 8px 0 0;
  padding-left: 9px;
  border-left: 2px solid var(--line);
  color: var(--ink-dim);
}

.panel-title .muted { color: var(--ink-dim); float: right; }

.clusters {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 168px;
  overflow: hidden;
}
.clusters li {
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
  cursor: pointer;
}
.clusters li:hover .cluster-label { color: var(--ink); }
.cluster-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.cluster-label { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; }
.cluster-size { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.clusters li.on .cluster-label { color: var(--accent); }

.log {
  flex: 1;
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.log li {
  /* Never shrink: a fixed number of lines in a fixed height would otherwise
     compress below the line height and print on top of each other. */
  flex: none;
  /* The name and the line run on as one sentence, so a scrobble wraps across
     the full width of the panel and its later lines hang under the name.
     Three lines each, so one talkative agent cannot fill the stream. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  padding-left: 1.3em;
  text-indent: -1.3em;
  animation: slide 0.25s ease-out;
}
.log .who { color: var(--ink); }
.log .what { color: var(--ink-dim); }
.log .kind-provisioned .who { color: var(--accent); }
.log .kind-deleted .who { color: var(--warn); }

@keyframes slide { from { opacity: 0; transform: translateY(-4px); } }

/* ---- tooltip and legend ---- */

.tooltip {
  position: fixed;
  z-index: 5;
  max-width: 300px;
  padding: 7px 9px;
  background: rgba(8, 10, 13, 0.94);
  border: 1px solid var(--line);
  border-radius: 6px;
  pointer-events: none;
  word-break: break-all;
}
.tooltip b { font-weight: normal; color: var(--accent); }
.tooltip span { color: var(--ink-dim); }

.legend {
  position: fixed;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-root { background: #c9cfd8; width: 11px; height: 11px; }
.dot-child { background: #8a93a0; width: 7px; height: 7px; }
.dot-hub { background: transparent; border: 2px solid #c9cfd8; width: 13px; height: 13px; }
.hint { opacity: 0.65; }

@media (max-width: 1100px) {
  .panel { display: none; }
  .legend { display: none; }
}
