/* ============================================================================
   ATLAS REDESIGN — Team & AI Workforce screen styles  ·  Phase 2
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-team. Tokens only (--r-*) so Calm (almanac) + Operator themes
   both work automatically. No hardcoded hex. Theme-specific selectors
   (html[data-rtheme="operator"] …) are used only where a token can't express
   the tweak (rare). Backs the BROKERAGE → People view (data-view "team" + "agents").
   ========================================================================== */

.rd-team {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: var(--r-page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- page header --------------------------------------------------------- */
.rd-team-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-team-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-team-h1 {
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h1);
  font-weight: 600;
  line-height: 1.1;
  color: var(--r-ink);
  margin: 0;
}
.rd-team-sub {
  margin: 2px 0 0;
  font-size: var(--r-fs-body);
  line-height: 1.5;
  color: var(--r-muted);
  max-width: 640px;
}

/* ---- KPI strip (4-up) ---------------------------------------------------- */
.rd-team-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.rd-team-kpi {
  background: var(--r-surface);
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rd-team-kpi-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-team-kpi-value {
  font-family: var(--r-font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  color: var(--r-ink);
}
.rd-team-kpi-foot {
  font-size: var(--r-fs-meta);
  color: var(--r-muted);
  min-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-team-kpi[data-tone="good"] .rd-team-kpi-foot { color: var(--r-good); font-weight: 600; }
.rd-team-kpi[data-tone="good"] .rd-team-kpi-value { color: var(--r-good); }

/* ---- main grid (workforce | side) ---------------------------------------- */
.rd-team-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); /* auto-min blew the screen to 1379px at 1024w */
  gap: 16px;
  align-items: start;
  min-height: 0;
}

/* ---- shared card head ---------------------------------------------------- */
.rd-team-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.rd-team-card-title {
  margin: 0;
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h2);
  font-weight: 600;
  color: var(--r-ink);
}
.rd-team-card-note {
  font-size: 12px;
  color: var(--r-muted);
}

/* ---- AI workforce card --------------------------------------------------- */
.rd-team-workforce {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rd-team-agent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  overflow: auto;
  max-height: calc(100vh - 320px);
  padding: 2px;
  margin-left: -2px;
  margin-right: -2px;
}

/* one AI agent card */
.rd-team-agent {
  background: var(--r-surface-2);
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-card);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease),
              border-color var(--r-dur) var(--r-ease);
}
.rd-team-agent:hover {
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-2px);
  border-color: var(--r-border);
}
.rd-team-agent:focus-visible { outline: var(--r-focus); outline-offset: 2px; }
.rd-team-agent[data-idle="1"] { opacity: .75; }

.rd-team-agent-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rd-team-agent-ic {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--r-mint-surface);
  color: var(--r-primary);
}
.rd-team-agent-ic i { font-size: 19px; }
.rd-team-agent-ic[data-tone="warn"] {
  background: color-mix(in srgb, var(--r-amber) 16%, transparent);
  color: var(--r-amber);
}
.rd-team-agent-ic[data-tone="idle"],
.rd-team-agent-ic[data-tone="none"] {
  background: var(--r-well);
  color: var(--r-faint);
}
.rd-team-agent-id { flex: 1; min-width: 0; }
.rd-team-agent-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-team-agent-role {
  font-size: 12px;
  color: var(--r-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* status badge */
.rd-team-status {
  flex: none;
  font-family: var(--r-font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 5px;
  padding: 2px 7px;
  background: var(--r-well);
  color: var(--r-muted);
  white-space: nowrap;
}
.rd-team-status[data-tone="good"] { background: var(--r-mint-surface); color: var(--r-good); }
.rd-team-status[data-tone="warn"] {
  background: color-mix(in srgb, var(--r-amber) 16%, transparent);
  color: var(--r-amber);
}
.rd-team-status[data-tone="idle"],
.rd-team-status[data-tone="none"] { background: var(--r-well); color: var(--r-faint); }

/* card footer stats (TODAY / AUTONOMY) */
.rd-team-agent-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--r-hairline);
}
.rd-team-stat-r { text-align: right; }
.rd-team-stat-label {
  font-family: var(--r-font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--r-faint);
}
.rd-team-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--r-ink);
  margin-top: 2px;
}
.rd-team-stat-value[data-tone="good"] { color: var(--r-good); }
.rd-team-stat-value[data-tone="warn"] { color: var(--r-amber); }

/* ---- side column --------------------------------------------------------- */
.rd-team-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* human team card */
.rd-team-human {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 18px 20px;
}
.rd-team-member-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  overflow: auto;
  max-height: calc(100vh - 360px);
}
.rd-team-member {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-team-member:first-child { border-top: none; }
.rd-team-av {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--r-font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--r-mint-surface);
  color: var(--r-mint-ink);
}
.rd-team-member-id { flex: 1; min-width: 0; }
.rd-team-member-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-team-member-role {
  font-size: 12px;
  color: var(--r-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Trust Center note */
.rd-team-trust {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--r-well);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  padding: 13px 16px;
}
.rd-team-trust i { flex: none; font-size: 16px; color: var(--r-good); }
.rd-team-trust p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--r-muted);
}

/* ---- empty states (honest, dashed) --------------------------------------- */
.rd-team-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .02em;
  color: var(--r-faint);
  text-align: center;
  padding: 28px 12px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
  margin-top: 14px;
}
.rd-team-empty i { font-size: 18px; color: var(--r-faint); }
.rd-team-human .rd-team-empty,
.rd-team-side .rd-team-empty { margin-top: 8px; }

/* ---- entrance motion (one-shot; off under reduced motion) ---------------- */
@keyframes rd-team-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rd-team-head, .rd-team-kpis-slot, .rd-team-grid > * {
  animation: rd-team-rise .32s var(--r-ease) both;
}
.rd-team-kpis-slot { animation-delay: .04s; }
.rd-team-grid > * { animation-delay: .08s; }
.rd-team-agent-grid > *,
.rd-team-member { animation: rd-team-rise .26s var(--r-ease) both; }
.rd-team-agent-grid > *:nth-child(2),
.rd-team-member:nth-child(2) { animation-delay: .03s; }
.rd-team-agent-grid > *:nth-child(3),
.rd-team-member:nth-child(3) { animation-delay: .06s; }
.rd-team-agent-grid > *:nth-child(n+4),
.rd-team-member:nth-child(n+4) { animation-delay: .09s; }
@media (prefers-reduced-motion: reduce) {
  .rd-team-head, .rd-team-kpis-slot, .rd-team-grid > *,
  .rd-team-agent-grid > *, .rd-team-member { animation: none; }
}
html[data-rmotion="reduced"] .rd-team-head,
html[data-rmotion="reduced"] .rd-team-kpis-slot,
html[data-rmotion="reduced"] .rd-team-grid > *,
html[data-rmotion="reduced"] .rd-team-agent-grid > *,
html[data-rmotion="reduced"] .rd-team-member { animation: none; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .rd-team-grid { grid-template-columns: minmax(0, 1fr); } /* bare 1fr's auto min let card-head min-content push past the viewport */
  .rd-team-agent-grid { max-height: 56vh; }
  .rd-team-member-list { max-height: none; }
}
@media (max-width: 720px) {
  .rd-team-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-team-agent-grid { grid-template-columns: minmax(0, 1fr); }
  .rd-team-card-head { flex-wrap: wrap; row-gap: 6px; }
}
@media (max-width: 400px) {
  .rd-team-agent-foot { flex-wrap: wrap; row-gap: 8px; }
  .rd-team-stat-r { text-align: left; }
}
