function cmd::list::show_client() {
  local name="$1"
  local conf
  conf="$(ctx::clients)/${name}.conf"

  if [[ ! -f "$conf" ]]; then
    log::error "Client not found: ${name}"
    return 1
  fi

  local ip allowed_ips public_key
  ip=$(grep "^Address" "$conf" | awk '{print $3}' | cut -d'/' -f1)
  allowed_ips=$(grep "^AllowedIPs" "$conf" | cut -d'=' -f2- | xargs)
  public_key=$(keys::public "$name" 2>/dev/null || echo "unknown")

  local type
  type=$(peers::get_type "$ip")

  local endpoint="—"
  if peers::is_blocked "$name"; then
    local ep
    ep=$(monitor::last_endpoint "$name")
    [[ -n "$ep" ]] && endpoint="$ep"
  else
    local ep
    ep=$(monitor::endpoint_for_key "$public_key")
    [[ -n "$ep" ]] && endpoint="$ep"
  fi

  # Get handshake and last attempt for status/last_seen
  local handshake_ts
  handshake_ts=$(wg show "$(config::interface)" latest-handshakes 2>/dev/null \
    | grep "^${public_key}" | awk '{print $2}')
  handshake_ts="${handshake_ts:-0}"

  local last_ts
  last_ts=$(monitor::last_attempt "$name")

  local is_blocked="false"
  peers::is_blocked "$name" && is_blocked="true"

  local status last_seen
  status=$(cmd::list::_format_status "$name" "$public_key" \
    "$is_blocked" "false" "$handshake_ts" "$last_ts")
  last_seen=$(cmd::list::_format_last_seen "$name" "$public_key" \
    "$is_blocked" "$last_ts" "" "$handshake_ts")

  local block_file
  block_file="$(ctx::block::path "${name}.block")"
  local blocks=""
  if [[ -f "$block_file" ]] && [[ -s "$block_file" ]]; then
    while IFS=" " read -r client_ip target port proto; do
      if [[ -z "$target" ]]; then
        blocks+="      all traffic blocked\n"
      else
        local rule="      ${target}"
        [[ -n "$port" ]] && rule+=":${port}/${proto}"
        blocks+="${rule}\n"
      fi
    done < "$block_file"
  fi

  ui::section "Client: ${name}"
  ui::row "IP"          "$ip"
  ui::row "Type"        "$type"
  ui::row "Status"      "$(echo -e "$status")"
  ui::row "Endpoint"    "$endpoint"
  ui::row "Last seen"   "$last_seen"
  ui::row "AllowedIPs"  "$allowed_ips"
  ui::row "Public key"  "$public_key"

  if [[ -z "$blocks" ]]; then
    ui::row "Blocks" "none"
  elif [[ "$blocks" == *"all traffic blocked"* ]]; then
    ui::row "Blocks" "$(echo -e "\033[1;31mAll\033[0m")"
  else
    printf "  %-20s\n" "Blocks:"
    echo -e "$blocks"
  fi
  printf "\n"
}