/* Swarm Workspace — Slack/Discord-style comms UI (Mission Control → Workspace tab) */
.swarm-tab-panel[data-stab="workspace"].s-active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.comms-shell {
  display: grid;
  grid-template-columns: 220px 240px minmax(0, 1fr);
  height: clamp(520px, 70vh, 900px);
  min-height: 0;
  background: #0a0c12;
  border: 1px solid var(--line);
  border-radius: var(--r, 12px);
  overflow: hidden;
}
.comms-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.comms-col-main {
  border-right: 0;
  background: rgba(0, 0, 0, 0.12);
}
.comms-col-head {
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.comms-col-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--soft);
}
.comms-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.comms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}
.comms-item:hover { background: rgba(255, 255, 255, 0.06); }
.comms-item.active {
  background: rgba(127, 90, 240, 0.22);
  color: #fff;
}
.comms-item-icon { font-size: 16px; flex-shrink: 0; }
.comms-item-meta { font-size: 11px; color: var(--soft); margin-left: auto; }
.comms-add-btn {
  margin: 8px;
  width: calc(100% - 16px);
  justify-content: center;
  font-size: 12px;
}
.comms-channel-hash { color: var(--soft); font-weight: 600; }
.comms-main-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
}
.comms-main-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.comms-main-head .topic { font-size: 12px; color: var(--soft); }
.comms-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comms-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.comms-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(127, 90, 240, 0.35);
  color: #fff;
}
.comms-avatar.agent { background: rgba(0, 200, 200, 0.28); }
.comms-avatar.node { background: rgba(255, 180, 0, 0.28); }
.comms-avatar.system { background: rgba(120, 120, 120, 0.35); }
.comms-msg-body { flex: 1; min-width: 0; }
.comms-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.comms-msg-name { font-weight: 700; font-size: 13px; }
.comms-msg-time { font-size: 11px; color: var(--soft); }
.comms-msg-text { font-size: 13.5px; line-height: 1.55; word-break: break-word; white-space: pre-wrap; }
.comms-mention {
  color: var(--c-cyan);
  background: rgba(0, 200, 200, 0.12);
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 600;
}
.comms-composer-wrap {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
}
.comms-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.comms-composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  resize: vertical;
  font-size: 13.5px;
  line-height: 1.5;
}
.comms-mention-menu {
  position: absolute;
  bottom: calc(100% - 4px);
  left: 16px;
  right: 16px;
  max-height: 200px;
  overflow-y: auto;
  background: #12151f;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  display: none;
  z-index: 20;
}
.comms-mention-menu.show { display: block; }
.comms-mention-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}
.comms-mention-opt:hover, .comms-mention-opt.active { background: rgba(127, 90, 240, 0.2); }
.comms-empty {
  color: var(--soft);
  text-align: center;
  padding: 48px 24px;
  font-size: 13px;
  line-height: 1.6;
}
.comms-member-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--soft);
  margin: 2px;
}
@media (max-width: 900px) {
  .comms-shell { grid-template-columns: 1fr; }
  .comms-col-companies, .comms-col-channels { display: none; }
}

/* --- live activity (Epic 2.1) ---------------------------------------------
 * A dispatched task used to leave no trace in the channel until it finished.
 * For work that runs minutes that is most of the experience, and an idle-
 * looking channel is why the swarm felt unresponsive. This sits between the
 * header and the feed, so it is the first thing the eye lands on.
 */
.comms-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 200, 200, 0.06);
  flex-shrink: 0;
}
.comms-activity-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}
.comms-activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-cyan);
  animation: comms-working 1.4s ease-in-out infinite;
}
@keyframes comms-working { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .comms-activity-dot { animation: none; }
}
.comms-activity-name { font-weight: 600; }
.comms-activity-what { color: var(--soft); }
.comms-activity-time { font-family: var(--mono); font-size: 11px; color: var(--soft); }
.comms-activity-stop {
  margin-left: auto;
  padding: 3px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  cursor: pointer;
}
.comms-activity-stop:hover:not(:disabled) { border-color: var(--c-red); color: var(--c-red); }
.comms-activity-stop:disabled { opacity: .5; cursor: default; }

/* --- artifacts (Epic 2.3) -------------------------------------------------
 * An agent reports what it produced by path. Printing that path in a chat
 * bubble leaves the reader to copy it into a file manager; the server already
 * serves these through /api/artifacts/file, so they are links.
 */
.comms-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.comms-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 11.5px;
  text-decoration: none;
  overflow: hidden;
}
.comms-attachment:hover { border-color: var(--c-cyan); }
.comms-attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comms-attachment-kind {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--soft);
  flex-shrink: 0;
}
/* A screenshot is often the whole answer, so show it without a click. */
.comms-attachment.is-image { flex-direction: column; align-items: flex-start; max-width: 220px; }
.comms-attachment.is-image img {
  width: 100%;
  max-height: 130px;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}

/* --- steering (Epic 3.2) --------------------------------------------------
 * Correcting a running task is a different act from talking to the channel,
 * and both happen through the same composer. These make the difference
 * visible: which task is armed before you send, and afterwards which lines in
 * the transcript changed work that was already under way.
 * ------------------------------------------------------------------------ */
.comms-activity-steer {
  padding: 2px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--soft);
  font-size: 11px;
  cursor: pointer;
}
.comms-activity-steer:hover { border-color: var(--c-cyan); color: var(--c-cyan); }

.comms-steer-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 16px 6px;
  padding: 6px 12px;
  border: 1px solid var(--c-cyan);
  border-radius: 8px;
  background: rgba(0, 200, 200, 0.08);
  font-size: 12px;
  color: var(--text);
}
.comms-steer-banner button {
  border: none;
  background: transparent;
  color: var(--soft);
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
}
.comms-steer-banner button:hover { color: var(--c-cyan); }

.comms-msg-steering { border-left: 2px solid var(--c-cyan); padding-left: 10px; }
.comms-msg-tag {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(0, 200, 200, 0.14);
  color: var(--c-cyan);
  font-size: 10.5px;
  letter-spacing: .02em;
}
